• Resolved Ajay Maurya

    (@ajmaurya)


    I am creating a user role who has the only the capability to edit the post but not publish it.
    This works for pages but when I did the same thing with the Custom Post Types I am not getting the Submit for Review button, instead, it directly shows “Publish” button.

    This is my code for Creation of Custom Post Type.
    /**
    * Post Type: Careers.
    */

    $labels = array(
    “name” => __(“Careers”, “mytheme”),
    “singular_name” => __(“Career”, “mytheme”),
    );

    $args = array(
    “label” => __(“Careers”, “mytheme”),
    “labels” => $labels,
    “description” => “”,
    “public” => true,
    “publicly_queryable” => true,
    “show_ui” => true,
    “show_in_rest” => false,
    “rest_base” => “”,
    “has_archive” => false,
    “show_in_menu” => true,
    “exclude_from_search” => false,
    “capability_type” => “post”,
    “map_meta_cap” => true,
    “hierarchical” => false,
    “rewrite” => array( “slug” => “careers”, “with_front” => false ),
    “query_var” => true,
    “menu_icon” => “dashicons-businessman”,
    “supports” => array( “title”, “editor”, “thumbnail” ,”revisions”),
    );

    register_post_type(“career”, $args);

    Note- I have enabled this option in the settings page ” Include capabilities for all custom post types in the WordPress Revisor role”

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter Ajay Maurya

    (@ajmaurya)

    Is it something to do with the “capability_type” and the “capabilities” array?

    Plugin Author Kevin Behrens

    (@kevinb)

    Yes. If you want this access to be the same as Pages, set capability_type to ‘page’

    If you would like the ability to control access separately for your custom post type, you can define the capabilities uniquely for that type. One easy way to do that is to activate our Capability Manager Enhanced plugin. On the Users > Capabilities screen, the right sidebar has a “Type-Specific Capabilities” section. If you enable Careers, a corresponding row will be added to the Reading, Editing And Deletion checkbox grid up top and access to your post type will be governed by those settings.

    Thread Starter Ajay Maurya

    (@ajmaurya)

    Hi Kevin,

    Thank’s for the quick reply. I saw the Capability Manager Enhanced plugin.
    But what solved my problem was adding capabilities array to my custom taxonomy and then adding those custom capability to my User Role Editor plugin screen.

    “capabilities” => array(
    ‘manage_terms’ => ‘manage_category’,
    ‘edit_terms’ => ‘edit_category’,
    ‘delete_terms’ => ‘delete_category’,
    ‘assign_terms’ => ‘assign_category’
    ),

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Submit for Review not working with Custom Post Types’ is closed to new replies.