Prevent authors to directly publish posts – WordPress

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

    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

    Very few things have disrupted the digital marketing scene as greatly as WordPress has in the last decade. Thanks to the platform’s free and simple content management system it made it possible for anyone, regardless of levels of technical knowledge, to create impressive websites.

    Modern brands have an entire selection of platforms which they can use to build their online presence and establish themselves as a relevant entity in their industry, and yet, WordPress remains high on the list of platforms most frequently chosen for precisely this purpose.

    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.