How to allow contributors to edit and publish their WordPress posts

WordPress does not allow Contributor to publish its articles. But still I have seen that many WordPress users want the Contributor to edit and publish their posts.

In such a situation you will have to use custom script. So let’s see how to allow Contributor to publish posts in WordPress:

// get the "contributor" role object
$obj_existing_role = get_role( 'contributor' );

// add the "Edit published posts" capability
$obj_existing_role->add_cap( 'edit_published_posts' );

// add the "Publishing" capability
$obj_existing_role->add_cap( 'publish_posts' );

Now you must be thinking how to default it again. Let’s see how to remove permission again.

// remove the "Edit published posts" capability
$obj_existing_role->remove_cap( 'edit_published_posts' );

// remove the "Publishing" capability
$obj_existing_role->remove_cap( 'publish_posts' );

If you are a newbie in WordPress development then you should also know where to write this custom script. Many blogs will tell you to add it to the function of your theme, but I’ll tell you a good solution to it so that there is no further issues in your theme.

step 1

  • Go to CPanel and open WordPress directory.
  • Create New PHP file in your plugin directory . For Ex – “Custom.php”.

step 2

–¬† Write these code first:

< ? php
Plugin Name: Custom 
Plugin URI:
Description: Created by AR Mishra
Author: AR
Author URI:
License: Self Generated
License URI: -
Version: 1.0

Step 3

  • Add your Script below the Description in your custom.php file.
  • Save the file.

Step 4

  • Open WordPress Admin Panel
  • Activate your custom Plugin.
  • DONE

Comments to: How to allow contributors to edit and publish their WordPress posts

Your email address will not be published. Required fields are marked *



You can make anything by Reading and Writing.
Join Aranjra