How to Disable Delete Post Option for Authors in WordPress


Managing a multi-author blog is not an easy task. You have to take lots of care to keep control of the content. Authors can not just publish their posts but they can also delete their own posts. If you do not want to allow authors to delete their posts, you have no default option on WordPress to set this. But, you can still do this. In this article, I will show you how to prevent authors from deleting their own posts in WordPress. By using the ways given in this article, you can quickly disable the Delete Post option from their dashboard. And they can no longer delete any of the posts they have written on your blog.

Why Prevent Authors From Deleting Their Own Posts in WordPress

Best Managed WordPress Hosting

WPEngine is the best and most secure managed hosting provider

There could be lots of reasons for preventing authors from deleting their posts. There have been many incidents in the past when authors didn’t work properly and when asked to leave, they deleted all the posts written by them. So, it is better to block them from deleting their posts. If there is any need to delete a post from the past, the admin should do it from his/her end.

Disable Delete Post Option for Authors in WordPress

Now take a look at ways to prevent authors from deleting posts. I am listing two ways of doing this. You can either do it by adding a code in functions.php or installing a plugin for better control over the whole functionality.

Manually Prevent Authors From Deleting Their Own Posts By Modifying Theme code

If you know how to modify theme files, you need to use this way. The method can make your website down if you do anything wrong. If you are not a developer, I recommend you to try the Plugin way, which I have added later in this article.

You can either add the following code directly to the functions.php file or create a site-specific plugin. The site-specific plugin makes sure that you do not lose your code even if you change the theme in the future.

Use this code to revoke access to delete option

function qwr_change_author_role(){
    global $wp_roles;
    $wp_roles->remove_cap( 'author', 'delete_posts' );
    $wp_roles->remove_cap( 'author', 'delete_published_posts' );
add_action('init', 'qwr_change_author_role');

Use this code to give access to the delete option

If you want to revert back the permissions, removing the added code will not help. You need to remove the code and add another code to define new permissions. SO replace the previously added code with this new code.

function qwr_change_author_role(){
    global $wp_roles;
    $wp_roles->add_cap( 'author', 'delete_posts' );
    $wp_roles->add_cap( 'author', 'delete_published_posts' );
add_action('init', 'qwr_change_author_role');

Now you know how to do this by modifying code. If you do not want to edit code, you can try the next way that uses Plugin.

2. Use Plugin to Prevent Authors From Deleting Posts

This method is easier and recommend. You need to install and activate the WordPress plugin called PublishPress Capabilities.

After installation, this plugin adds a new option ‘Capabilities’ under the ‘Users’ menu. Go to this page and you will get access to the page where you can change the permissions of a user. Not just delete a post, you can also change editing permissions as well.

Role Capabilities WordPress

You need to select the role from the drop-down on the right side of the page to load the existing permission. Then make changes as per your need and save. You can also create a new role and assign permission as per your requirements.

You can always alter the permissions and make changes as per your need.

Note: Uninstalling this plugin will not revert back the changes. You need to manually do that before uninstalling this plugin.

There is also an option to reset all the changes made by this plugin. visit the Tools » Capability Manager page and click on the ‘Reset to WordPress defaults’ link. It will revert back to default WordPress capabilities. Then you can safely remove this plugin.

Final Words

Now you know how to change the permissions of an author and revoke access to the delete option. If you want to prevent authors from having access to the delete posts option, you can use any of the given ways. I recommend you go with the second option that uses the plugin. It will be easier and safe. If you do not understand code, using the first method is risky.

I hope this article was clear. If you still have anything to ask, you can always leave a comment.


Deepanker Verma is an experienced WordPress developer who has been working on WordPress for more than 12 years. On TheWPGuides, he writes about WordPress, WordPress development, and WordPress plugins.

Similar Articles


Leave a comment

Comment policy: We love comments and appreciate the time that readers spend to share ideas and give feedback. However, all comments are manually moderated and those deemed to be spam or solely promotional will be deleted.

© 2022 The WP Guides Developed By Deepanker