How to grant capability to add item in custom taxonomy?

I've created a custom post-type: trades
I've created a custom taxonomy (tag) : trades_cat

I have given Subscribers the ability to publish trades using xml-rpc extension, which checks them to make sure that they are subscribers and then use their role to publish trades.

Everything seems to work fine when I am using my admin account, but when I switch to an Subscriber account, the trades, custom post-type, gets published, but the trades_cat does not. So the trades show up with NO trades_cat.

trades_cat is basically a list of brokers, since trades are generated from different brokers, every Subscriber may use an existing trades_cat, or they may need to create one.

Subscribers seems to lack the capability to assign trades_cat, or manage_trades_cat, how can I use custompress and give them those custom capabilities? If there is a workaround, such as a filter to fix this issue temporarily until the next update, that would work for me.

I think this maybe something to consider in the future for custompress, why not include the capability function as well in the custom taxonomy?


  • aecnu
    • WP Unicorn

    Greetings henry_liu,

    Thank you for the great question.

    I think this maybe something to consider in the future for custompress, why not include the capability function as well in the custom taxonomy?

    Though I do not know the answer and this ticket could very well quickly turn into a feature request, I will see if I can get the lead developer in here with his invaluable insight into this plugin for his advice/advise for us concerning this possibility.

    Though this may take a bit longer then a normal ticket, I will try to get him in here asap.

    Cheers, Joe

  • Arnold
    • El Macho WP

    There are four capabilities attached to taxonomies.

    'manage_terms' => 'manage_categories',
    'edit_terms'   => 'manage_categories',
    'delete_terms' => 'manage_categories',
    'assign_terms' => 'edit_posts',

    To change categories requires "manage_categories" user capabilities, and since these are overall management security Custom press doesn't deal with it. If you want Subscribers to do that they will need the capability.

    The "assign_terms" defaults to "edit_posts". The "posts" part refers to the "Capability Type" setting on the post type the taxonomy is associated with. So in your "trade" post type you must have changed the Capability Type to other than "post" If so then you need to change the taxonomy capabiltiy to whatever that was.

    If Capability Type = "trade" then the right cap would be 'assign_terms' => 'edit_trades';

    It isn't in Taxonomy because you can associate one taxonomy with Multiple post types, including the built in ones like "post" and "page", your faced with people trying to assign_terms for multiple post types as well which won't work. Wordpress doesn't support it.

    The best thing in multiple postype situations is to leave the Capability Type set to "post" and it automatically picks up the default. If you really want to split it. then you will need an action to fix it up and you should undertand what your doing or don't attempt. It relatively simple.

    function assign_trade_terms(){
      global $wp_taxonomies;
      $wp_taxonomies['trade_cat']->cap>assign_terms = 'edit_trades';
    add_action('init', 'assign_trade_terms');
  • henry_liu
    • WPMU DEV Initiate
    function assign_trade_terms(){
      global $wp_taxonomies;
      $wp_taxonomies['trades_cat']->cap->assign_terms = 'edit_trades';
    add_action('init', 'assign_trade_terms');

    ...worked out beautifully, I added this in my functions.php for my theme. Thank you.
    I had to add "-" between ->cap "-">assign_terms as it seems to be a typo. The working code is reflected above.

    Thanks again,


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.