Running a multi-author website requires a lot of trust, but accidents happen when you have many cooks in the kitchen. We learned quickly that even experienced writers can mistakenly delete a published post when trying to remove a draft.
By default, WordPress gives authors full control to delete their own content, which can be risky for your site’s history. This setting often leads to accidental content loss that is difficult to recover.
At WPBeginner, we modify user permissions to prevent this, ensuring that only editors and admins can remove live articles. This setup keeps our content secure and gives us peace of mind.
In this article, we will show you how to stop authors from deleting their own posts in WordPress.

Why Prevent Authors From Deleting Their Posts in WordPress?
WordPress comes with a powerful user role management system. Each registered user on your website is assigned a user role with different permissions.
Users with the ‘author’ role can write posts and publish them on your website. This role is generally used by multi-author WordPress blogs.
Authors can also delete their own posts, including those already published.
However, as a website owner, you may want to prevent authors from doing that to prevent accidental post-deletion or to control the content that is published or removed on your WordPress blog.
The easiest way to do that is by modifying the author user role and changing its permissions in WordPress.
Let’s take a look at how to easily prevent authors from deleting their own posts.
In this article, we will show you two methods, and you can use the links below to jump to the method of your choice:
- Method 1: Prevent Authors From Deleting Posts Using a Plugin
- Method 2: Prevent Authors From Deleting Their Posts Using WPCode
- Bonus: Limit Authors to Their Posts in WordPress
- Frequently Asked Questions About Preventing Post Deletion
- Additional Resources
Method 1: Prevent Authors From Deleting Posts Using a Plugin
If you are looking for an easy way to prevent authors from deleting posts, then this method is for you.
First, you need to install and activate the PublishPress Capabilities plugin. For more details, see our step-by-step guide on how to install a WordPress plugin.
📒 Note: You can also use the premium version in the PublishPress Pro bundle for the plugin to control more permission settings. However, the free plan will also work for this tutorial.
Upon activation, head over to the Capabilities » Capabilities page from the WordPress admin sidebar.
Once you are there, choose the ‘Author’ option from the role capabilities dropdown menu in the left corner of the screen.

Next, you need to switch to the ‘Deletion’ tab in the left column on the screen.
After that, simply uncheck the ‘Delete’ and ‘Delete Published’ options from the ‘Posts’ row.
Finally, click the ‘Save Changes’ button to store your settings.

Now, the authors on your WordPress site won’t be able to delete their posts, even those that are already published.
This is how the Posts page in the WordPress dashboard will look for your authors:

Giving Back Permissions
The changes you make to user roles are saved permanently in your WordPress database. This means that even if you deactivate or uninstall the plugin, the settings will not automatically go back to default. You must manually give the permissions back to reverse the changes.
If you want to give back authors permission to delete, then you will have to repeat the process and check the boxes next to the delete and delete published posts options.
If you want to uninstall the plugin and revert to default WordPress capabilities, you must first visit the Capabilities » Backup page from the WordPress admin dashboard.
From here, switch to the ‘Reset Roles’ tab and then click the ‘Reset to WordPress defaults’ button.
Now, all the modified role definitions will be deleted, and your WordPress user roles will revert to their original capabilities.

Note: Once you remove these permissions, the ‘Trash’ link will disappear for authors. They will no longer be able to move posts to the trash.
Method 2: Prevent Authors From Deleting Their Posts Using WPCode
If you want to prevent authors from deleting posts using custom code, then this method is for you.
You can easily add custom code to your theme’s functions.php file. However, keep in mind that the smallest error can break your website.
That is why we recommend using WPCode to add custom code to your WordPress site.
After thorough testing, we have concluded that it is the best WordPress code snippets plugin on the market. It makes it super safe and easy to add custom code. To learn more about our experience with the tool, see our WPCode review.
First, you need to install and activate the WPCode plugin. For detailed instructions, please see our beginner’s guide on how to install a WordPress plugin.
📒 Note: WPCode has a free version that you can use for this tutorial. However, upgrading to the pro version will give you access to features like the cloud library of code snippets, conditional logic, and more.
Upon activation, head over to the Code Snippets » + Add Snippet page from the WordPress admin sidebar.
Once you are there, just click the ‘+ Add Custom Snippet’ button under the ‘Add Your Custom Code (New Snippet)’ option.

Then, you need to choose ‘PHP Snippet’ as the code type from the list of options that appear on the screen.

This will open the ‘Create Custom Snippet’ page, where you can start by typing a name for your code snippet.

Next, simply copy and paste the following code into the ‘Code Preview’ box:
function wpb_change_author_role(){
global $wp_roles;
$wp_roles->remove_cap( 'author', 'delete_posts' );
$wp_roles->remove_cap( 'author', 'delete_published_posts' );
}
add_action('init', 'wpb_change_author_role');
After that, scroll down to the ‘Insertion’ section and choose the ‘Auto Insert’ mode.
Your code will be automatically executed once you activate it.

Next, scroll back to the top of the page and toggle the switch to ‘Active’.
Finally, click the ‘Save Snippet’ button to save and execute your code on your WordPress site.

This code changes the author user role and removes their capability to delete their own posts.
This is how the Posts page in the WordPress dashboard will look for authors:

Revert Permissions with WPCode
If, for some reason, you want to provide authors with the capability to delete their own posts again, then you can also do that with WPCode.
First, you’ll need to visit the Code Snippets page from the WordPress dashboard and toggle the switch next to the code snippet you created to ‘Inactive’.

However, simply deactivating the code will not make any changes because the settings were saved to your WordPress database. To revert these changes, you need to add a new code snippet to update the settings again.
To do this, visit the Code Snippets » + Add Snippet page from the WordPress dashboard.
Then, click the ‘+ Add Custom Snippet’ button underneath the ‘Add Your Custom Code (New Snippet)’ option.

Next, select ‘PHP Snippet’ as the code type from the list of options.
You will now be taken to the ‘Create Custom Snippet’ page, where you have to type a name for the snippet.
After that, simply copy and paste the following code into the ‘Code Preview’ box:
function wpb_change_author_role(){
global $wp_roles;
$wp_roles->add_cap( 'author', 'delete_posts' );
$wp_roles->add_cap( 'author', 'delete_published_posts' );
}
add_action('init', 'wpb_change_author_role');
Once you’ve pasted the code, scroll down to the ‘Insertion’ section and choose the ‘Auto Insert’ mode.
The code will automatically add the deletion capabilities for authors upon activation.

Finally, toggle the switch in the top right corner of the screen to Active and click the ‘Save Snippet’ button.
Your authors will now be able to delete their own posts in WordPress like before.

Bonus: Limit Authors to Their Posts in WordPress
Apart from preventing authors from deleting posts, you can also limit them to their posts in WordPress. This way, authors will only be able to edit, preview, and publish the posts they have written themselves.
If you run a multi-author blog or allow guest posts, this can be super helpful. It encourages writers to focus on their work and improves organizational clarity.
To restrict authors to their posts, you can use PublishPress Permissions.
Once configured, the plugin allows you to limit authors so that they see only their own posts in the WordPress admin area.

However, if you want to allow editors to review posts from different authors, then you will need to use PublishPress Capabilities.
For detailed instructions, see our tutorial on how to limit authors to their own posts in WordPress admin.
Frequently Asked Questions About Preventing Post Deletion
Many users ask us about the specific details of modifying user permissions in WordPress. Here are the answers to some of the most common questions.
1. Will preventing post deletion also stop authors from editing their posts?
No, removing the delete capability does not stop authors from editing content. Authors will still be able to edit and update their published posts; they simply will not be able to move those posts to the trash once they are saved or published.
2. Can I use the Contributor role to prevent users from deleting posts?
Yes, switching a user to the Contributor role prevents them from deleting published posts, but it also changes their workflow. Contributors cannot publish their own posts and must submit them for review. If you want users to publish freely without the risk of deleting content, you should keep them as Authors and modify their specific permissions.
3. Do these restrictions apply to Administrators or Editors?
No, these changes only affect the ‘Author’ user role. Administrators and Editors will retain full control over the site content, including the ability to delete posts created by any user.
4. Is it possible to reverse the permission changes later?
Yes, you can easily reverse these changes. If you used a plugin, you can re-check the delete permission boxes. If you used code snippets, you can disable the restrictive code and run a snippet to restore the default WordPress capabilities.
5. Is there a way to track if an author tries to delete a post?
Standard WordPress settings do not track blocked actions. However, you can use an activity log plugin like WP Activity Log to monitor successful changes and track general user behavior on your site.
Additional Resources
Now that you have customized your author permissions, you might want to learn more about managing your WordPress team and site security. Here are some other guides we recommend:
- Beginner’s Guide to WordPress User Roles and Permissions
- How to Monitor User Activity in WordPress With Security Audit Logs
- How to Limit Authors to Their Own Posts in WordPress Admin
- How to Add or Remove Capabilities to User Roles in WordPress
- How to Improve Your Editorial Workflow in Multi-Author WordPress Blogs
We hope this article helped you learn how to prevent authors from deleting their own posts in WordPress. You may also want to see our ultimate step-by-step guide on how to show personalized content to different users in WordPress and our expert picks for the best WordPress user management plugins.
If you liked this article, then please subscribe to our YouTube Channel for WordPress video tutorials. You can also find us on Twitter and Facebook.

kzain
I’ve had issues with authors accidentally deleting posts on my multi-author blog, and it’s caused headaches for me and my team. I didn’t know about the ‘delete_posts’ capability, so thank you for sharing that tip. I’ve already implemented the solution using the Role Editor plugin, and it’s given me peace of mind. One suggestion it might be helpful to add a note about how to restore a post if it’s accidentally deleted, just in case. Thanks again for the helpful tutorial
WPBeginner Support
Thank you for the suggestion!
Admin
Mohsin Uddin
Hi i am very greatful on all the content you create on this site, i have always found it extremely useful and a go to point for any problems i face…i am little stuck with my wp site at the moment and really hope you can shed some light on the matter.
I want to create a site where there are buyers and sellers.
Firstly i wanted buyers to register and be allowed to see content after they have paid..also theh need to be able to upload a few pictures.
Secondly i wanted sellers to register and also be able to post after they paid. And have access to restricted content.
For both users they can register or on seperate pages or select from a drop down menu that a person is a seller or buyer.
Once selected as a buyer, buyer should be able to select a category of interest.
I wanted the sellers account to automatically be have a certain user role and same for buyers.
Is this possible or would i need to handle every user role manually.
I would like users to have their own dashboard where they can upload items for sale etc..
I really hope you can help thanks in advance.