Allow a userclass to save a page as a draft – but not publish w/o admin approval

I want to make a user class that can edit pages, and save them as a draft without being able to publish it. An admin would have to go in and publish the draft once they approve it.

The idea is similar to TDO Mini Forms except this will be done within the WordPress admin panel, not be a form, and they must be a registered user in a specific class to do this.

Read More

Thanks!

Related posts

Leave a Reply

3 comments

  1. Sorich87 is right. The WP Codex describes a contributor as:
    Somebody who can write and manage their posts but not publish them. (See Roles and Capabilities). If you want people to automatically have this capability when they register, you can set the default role to Contributor in the settings panel.

    If you need additional permissions not handled by the built in WordPress permissions — say, for example, you want a user that can edit other people’s posts as well, but once they’re edited they go back to being drafts, or whatever — then there are several good Role Manager plugins. For more information see the documentation on Roles and Capabilities Plugin.

  2. Revisionary

    This plugin will do what you want. It creates a role Revisor that is kind of in between Contributor and Editor. The UI could be improved and the internal code had to work around a lot of WordPress’ missing features, but yeah, this solves your problem.

  3. This is what you may want to do (add the following code to your theme functions.php file or a custom plugin):

    function add_custom_role() {
        global $wp_roles;
        
        $custom_capabilities = array(
            'read', 'edit_posts', 'upload_files',
            'read_private_pages', 'edit_private_pages', 'read_private_posts',
            'edit_private_posts', 'edit_published_pages', 'edit_others_pages',
            'edit_pages', 'edit_published_posts', 'edit_others_post',
            'unfiltered_html', 'manage_options'
        );
    
        $wp_roles->add_role( 'custom_role', 'Custom Role', $custom_capabilities );
    }
    
    add_action( 'init', 'add_custom_role' );
    

    References:

    https://wordpress.org/support/article/roles-and-capabilities/

    http://www.wphardcore.com/2010/ultimate-guide-to-roles-and-capabilities/

    and a more modern article from a suggested edit:
    https://kinsta.com/blog/wordpress-user-roles/