How to not allow users to create new tags, but allow to them to use existing ones

The question:

I want a certain role to be able to add new tags, but other users should just be able to use the text bar to search for existing tags.

I know I can hide the tag bar in the sidebar, but I don’t want that. I just want it to say “Sorry, this tag does not exist” or something when someone enters a tag that doesn’t exist.

Is there a plugin or a function that will do that for me?

The Solutions:

Below are the methods you can try. The first solution is probably the best. Try others if the first one doesn’t work. Senior developers aren’t just copying/pasting – they read the methods carefully & apply them wisely to each case.

Method 1

You can hook onto pre_insert_term, check the taxonomy and whether or not the user has the specified role as follows:

function disallow_insert_term($term, $taxonomy) {

    $user = wp_get_current_user();

    if ( $taxonomy === 'post_tag' && in_array('somerole', $user->roles) ) {

        return new WP_Error(
            __('Your role does not have permission to add terms to this taxonomy')


    return $term;


add_filter('pre_insert_term', 'disallow_insert_term', 10, 2);

This will prevent the user inserting new terms but allow them to search and add existing terms to a post.

Beaware that when on the post edit screen a user can enter in a term name that does not exist and press enter or click the add button which will add the term to the DOM however at this point the term is not added to the database until the user publishes or updates the post at which point the term will be disallowed.

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Comment