Recently I faced a scenario where I had to prevent certain users from adding new terms to some custom taxonomies that I created. After some research I found that there isn’t a straight forward way to do this using user capabilities or roles.
The only way is to use the
pre_insert_term hook and black-list taxonomies based on user capabilities. I am sharing the code here so that it would be useful for people who want to something similar.
In the above code change the taxonomy name and capability to suit your usecase.
- Email Log WordPress plugin v1.9.1 released
- Email Log WordPress plugin v1.9 released
- How to find if you are on the last page of a multi-page post in WordPress
- Easy Retweet WordPress plugin v3.1 Released
- Creating custom tables with correct Character Set and Collation in WordPress
- My contributions to WordPress 4.4