Grow with ScalaHosting Web Hosing Solutions

WordPress Prevent Author From Publishing Directly

Spread the love

Are you running a multi-author WordPress website? Or maybe you are just SEO conscious before anything is published.

Whatever your reasons are, regulating what goes live on your website is an integral undertaking. This is to have well optimized content for both your readers and search engine.

So, to prevent the author from directly publishing posts on your magazine or blog site. Simply put the following code in your theme’s functions.php file.

// Remove Author Publishing Capabilities 
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' );

How Does This Code Work

The code above removes post publishing capabilitIes from authors. When implemented, the authors will only have an option to “Submit” the post for review by your site administrator.

To avoid losing your settings in case of a theme update. Remember to only use this code in your Child-Theme and not parent.

Leave a Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.