When using a custom role permission for posts, taxonomy still uses "post" permission

So technically that wasn’t a question, I guess I could have put “why does this happen?” but I would rather like to know “how can we fix it?”.

I have setup a custom role “book” and allow any member who is registered to the site to be able to put their book into the system. However, when I logged into my test account I have found that the two taxonomies I have created (as “public”:wink: do not allow editing by a “subscriber” level user.

ScreenShot: http://cl.ly/KftK

It works fine in my admin account and when I upgraded the persons permissions it worked. I have the subscriber permission (under “book” rule set, not “post”:wink: to be able to edit their own books and post new books.

It seems to me that we just need to make it so that either:

1) the taxonomy respects the content type’s permissions.

or

2) the taxonomy requests permissions independently

  • Arnold
    • El Macho WP

    Can you clarify the setup? You created a “book” post_type, changed Capability Type to “book” from “post” and in the “Role Capabilities Settings” what exactly was set for the Subscriber role? And what was the setting when you “upgraded the persons permissions”?

    You may need to add the “assign_terms” capability which is not in the default set of meta capabilities. Something like “assign_terms” => “edit_book”.

  • travis_mccrea
    • WPMU DEV Initiate

    Yeah after re-reading this it sounds a little bit complicated:

    I have the following:

    Post Types = “books”

    Capability Type = “book”

    Capability Options = Subscriber can Edit Own Books and Create New Books

    Taxonomy = “authors”

    Public = “true”

    Post Type = “books”

    So you would assume that my taxonomy would follow the rules of my capability type. However, it looks as though the taxonomy option is not displaying for people who have the role “subscriber”.

  • Arnold
    • El Macho WP

    Register_taxonomy() defaults to a set of capabilities.

    $default_caps = array(
    'manage_terms' => 'manage_categories',
    'edit_terms' => 'manage_categories',
    'delete_terms' => 'manage_categories',
    'assign_terms' => 'edit_posts',
    );

    So a user who has edit_post capability would be able to edit taxonomies. Since you changed the capability type to “book” the subscribers would have “edit_book” capabilities. So no match.

    To change it you would need to change the taxonomies “cap” settings.

    global $wp_taxonomies;

    $wp_taxonomies['author']['cap']['assign_terms'] = 'edit_books';

    Probably hooked off of “init”

  • Timothy
    • Chief Pigeon

    Hello, hope you’re well!

    How’s things going now, we haven’t heard from you in a short while and as such he thread became marked as “Resolved”.

    If you’re still in need any help then please feel free to reopen or create a new thread as needed for any issues.

    Cheers.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.