Prevent authors to directly publish posts - WordPress

  • Share this:
Prevent authors to directly publish posts - WordPress

If you're running a blog or a magazine & want your authors not to directly publish posts on your blog or magazine, simply put the following code in your functions.php & your problem is solved.

function remove_author_publish_posts(){

    // $wp_roles is an instance of WP_Roles.
    global $wp_roles;
    $wp_roles->remove_cap( 'author', 'publish_posts' );

add_action( 'init', 'remove_author_publish_posts' );

What this piece of code does?

It removes the capability from author to publish posts directly & change the value of the publish button to "Submit for review" for the administrator.

Try it yourself & let us know if you get stuck at any point.

Usama Muneer

Usama Muneer

A web enthusiastic, self-motivated & detail-oriented professional Full-Stack Web Developer from Karachi, Pakistan with experience in developing applications using JavaScript, WordPress & Laravel specifically. Loves to write on different web technologies with an equally useful skill to make some sense out of it.