[wp-hackers] preventing new tags from being entered.

Haluk Karamete halukkaramete at gmail.com
Tue Sep 4 19:40:44 UTC 2012

I want a controlled tag vocabulary. And I want only editors and admins
to be able to control/add new tags. This is because my tag cloud
covers enough words/subjects ( 5000 of them! ) and they are all hand
picked and ready to use with proper spellings and abbreviations. And I
do not want my data entry people to add new tags on the fly.

I did some reading on this on WP forums. To solve this problem, some
people suggest to remove the add new tag button. But that suggestion
is not helpful cause it takes the textbox with it too. Since I want my
data entry people to take advantage of the type-ahead functionality
that WordpPress comes with, I'd like to keep the front end as is. That
is, they can still type in the first 3 characters of the subject
matter and pick one from the suggestions by simply hitting enter.

I don't think it is possible prevent a user to add a new tag at the
client/browser/javascript level. jQuery cannot stop that action from
taking place. However, this issue should easily be addressed at the
server level - when the actual post creation or update takes place.

The idea is this;

If the current user is not an editor or an admin, ignore the new
tag(s) completely. And execute the action as if that tag was not part
of the submission. And after the save or update is completed, warn the
user with a JS alert that some tag(s) were ignored. I'm assuming at
some point, WP does a look up if tag exists, and if not create the new
tag, get the newly created tag id and the use that in associating the
post. It should fairly simple to exit out carrying the action all the
way if WP detects, the tag is new and the user is not an admin/editor.

In order to pull this off, could someone guide me what hooks do I need
to use? Or suggest ideas if this is good way to approach the matter or


More information about the wp-hackers mailing list