Search

Programming
Programming

We provide developers and engineers the guides and tutorials they...

Content
Content

Content is king. It's not just about how you're going to write, b...

Events
Events

Looking for an engaging connection with thousands of other people...

Prevent authors to directly publish posts - WordPress

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.

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

About author

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.

View all posts (110)
Your experience on this site will be improved by allowing cookies Cookie Policy