Wordpress tags - select from pre-determined list?
I have a WordPress install in which registered users are allowed to post articles. The problem lies in the Tags section. I like the idea of letting them add tags, but it's getting crazy. Often there are 3 or 4 of the same tag just spelled differently, sometimes people put weird stuff for tags, etc. I'd like to be able to allow "adding" of tags to the posts, but not actual "creation" of the tag itself - I want the user to have to pick from a pre-determined list. That list could be a drop-down menu, some fancy jQuery thing, I really don't开发者_如何学Go care. Open to ideas/suggestions. Something maybe how StackOverflow does it? Thanks!
Are you able to use categories instead of tags? This would be easier to do by pre-loading categories and restricting users to a role that can't create categories.
If you really want to stick with tags, I think you'll have to search through Adam R Brown's list of action hooks and locate the hook that fires when a tag is added.
If an appropriate action hook isn't available, You could add your own.
I BELIEVE that tags are added by _wp_ajax_add_hierarchical_term() in wp-admin/admin-ajax.php and that is where you would add the custom hook. Look through the code in the trac page for the file. See if it makes sense and test it out.
Since no one else answered this question with a simple to use snippet, and since it is beyond my ability to write my own code, I am choosing an answer based on knowledge that is above me.
精彩评论