Prevent authors to directly publish posts – WordPress

Last Updated at : September 5, 2017 By - Usama Muneer | 1628

    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.

    blog user
    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.

    Related Posts

    If you are running any business on the online platform, then you might know that both of these concepts are important, and play a significant role in this technology-prone era.

    You are in constant danger. Maybe you do not realise. Maybe you are very naive and you think you are not going to attack, because you have nothing important to be attacked.

    We're not web designers, but rather we comprehend what it takes to make an extraordinary website utilising WordPress. Gratefully, we've been sufficiently fortunate to discover a huge amount of extraordinary web designers who know their stuff

    Once you become the owner of your WordPress’s website, you accept the ownership and try to build it in every way possible. But doing it the wrong way can leave you barehanded in the end. Yes, we are talking about the shortcuts that are mostly illegal and overlooks privacy.