I'm on WordPress 4.7.4 and on my custom post types, I cannot assign tags as a regular user.

I have used CPTUI for creating everything, have mapped and created custom capabilities, have assigned roles to the custom caps, and have verified the user's roles are correct using get_userdata(), but I can't seem to get this working.

On the CPT, the taxonomies variable has post_tag set and I can see the tags meta box, I just can't do anything with it. I have tried to separate the term capabilities using the function below and the user has the assign_post_tags role, but it doesn't seem to do anything. Any help would be greatly appreciated.

Register CPT:

function cptui_register_my_cpts_listing() {

     * Post Type: Listings.

    $labels = array(
        "name" => __( 'Listings', 'text-domain' ),
        "singular_name" => __( 'Listing', 'text-domain' ),

    $args = array(
        "label" => __( 'Listings', 'text-domain' ),
        "labels" => $labels,
        "description" => "",
        "public" => true,
        "publicly_queryable" => true,
        "show_ui" => true,
        "show_in_rest" => false,
        "rest_base" => "",
        "has_archive" => "archive-listing",
        "show_in_menu" => true,
        "exclude_from_search" => false,
        "capability_type" => "listing",
        "map_meta_cap" => true,
        "hierarchical" => false,
        "rewrite" => array( "slug" => "listing", "with_front" => true ),
        "query_var" => "listing",
        "supports" => array( "title", "editor", "thumbnail" ),
        "taxonomies" => array( "post_tag", "location" ),

    register_post_type( "listing", $args );

add_action( 'init', 'cptui_register_my_cpts_listing' );

Changing caps

function set_builtin_tax_caps() {
    $tax = get_taxonomy('post_tag');
    $tax->cap->manage_terms = 'manage_post_tags';
    $tax->cap->edit_terms = 'edit_post_tags';
    $tax->cap->delete_terms = 'delete_post_tags';
    $tax->cap->assign_terms = 'assign_post_tags';
    $tax = get_taxonomy('category');
    $tax->cap->manage_terms = 'manage_categories';
    $tax->cap->edit_terms = 'edit_categories';
    $tax->cap->delete_terms = 'delete_categories';
    $tax->cap->assign_terms = 'assign_categories';
add_action('init', 'set_builtin_tax_caps');
  • Anybody got any solution by now, please?
    – Shah Alom
    Oct 16, 2019 at 20:54
  • Did you try rogden's solution below? It sounds like it might be promising for a solution. This was several years ago, so as per my comment below, the workaround I used was to create a new taxonomy and that satisfied the requirements I needed to get the job done at the time and I moved on. It is also entirely possible that this functionality may have changed with Wordpress core updates, but I'm guessing you wouldn't be here if that were the case.
    – Nathan
    Oct 17, 2019 at 13:28
  • Still, the bug (should I say a security feature in the view of the WP core team) exists. I just moved with your suggestion to use another taxonomy. Anyway thanks for the reply.
    – Shah Alom
    Oct 18, 2019 at 21:44

2 Answers 2


It seems that although WP core creates four capability mappings for the built-in post_tag taxonomy (manage_terms => manage_post_tags, edit_terms => edit_post_tags, delete_terms => delete_post_tags, assign_terms => assign_post_tags) when it is registered, it uses different values when checking if the user has one of those capabilities.

If you look at the implementation of the map_meta_cap function in WP core (in wp-includes/capabilities.php lines 513-523), you can see that the edit_posts capability is returned for assign_post_tags and manage_categories is returned for manage_post_tags, edit_post_tags and delete_post_tags. To fix this, you can add a filter and return the expected values:

add_filter( 'map_meta_cap', function( $caps, $cap, $user_id, $args ) {
    $caps_to_fix = [

    if ( in_array( $cap, $caps_to_fix ) ) {
        $caps = [ $cap ];

    return $caps;
}, 10, 4 );

No matter what I tried, I couldn't get this working. I don't believe manually changing the terms are supported at this time for the post_tag taxonomy. Even if the user had the proper role and permission, you could not assign or edit post tags. The only solution I found was to create and register an entirely new taxonomy called "tags", define the custom capabilities, and set hierarchical to false.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.