When a user adds a tag to a post, I'm trying to determine if they have permission to post in to that specific tag. If the user is not assigned to a tag that they try adding via the input in the "Tags" meta box, I'd like to display an error along the lines of "you do not have permission to post in $tag_name.`

I know there are hooks for create_tag, but that doesn't fire until you actually save the post, because the tag doesn't get created until the post is saved. For exiting tags, it looks like set_object_terms could be useful, but again, that doesn't get fired until you actually save the post.

Does any filter exist when a user enters a tag in the input on in Tags meta meta box, after clicking "add"?

  • Forgive my confusion but if the tag "doesn't get created until the post is saved" as you say, why not using save_post action then? Do I miss something?
    – ClemC
    Commented Aug 16, 2017 at 16:25
  • I'm trying to check against pre-existing tags before the user submits, to display an error inline. Commented Aug 16, 2017 at 16:27
  • I couldn't find one myself. Your best bet is to look at sites like hookr.io that let's you search wp hooks -> example. Another option is to try to listen to the ajax response via JS.
    – gdaniel
    Commented Aug 16, 2017 at 16:47

1 Answer 1


try to use undocumented filter pre_insert_term.

What you need is not a filter, but an action called before insert terms, i have not found WordPress have this kind of action.

for another way of thinking, you can use create_term or created_term action, although they are called after term created, if a user have no permission, we can delete the term they just created.

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.