Support » Plugins » Custom Post Types And User Roles

  • Jaap



    I create custom post types in the plugin called ‘More Fields’.

    I have 5 different post types created.
    Like: Products, Cats, Dogs, Jobs, Pinguins.

    I have 2 user roles.
    Userrole 1 can post Products, Cats and Dogs.

    The other user role can post Jobs and Pinguins.

    When you post a new pinguin you see this in your URL


    When I am userrole 1 and I replace Pinguins to Products (Which only user role 2 should be able to post) I can post these posts too?

    So theres no restriction on that. Only the UI gets removed but not the access to it if you change your URL.

    How can this be fixed?

    Thanks in advance.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Depends how the capabilities are setup, default behvaiour for a post type is to inherit capabilities from the post post_type.

    See the capabilities parameter on the register_post_type page.



    Well yeah both user roles must be able to post Posts but not the posts That i dissalow in the plugin more fields. Now it only disables the menu but u can still acces other post types through the url bar. Hope that can be fixed would be real helpfull.

    I think you might be missing the point i was making before, if you don’t give your custom post type custom capabilities, the post type uses the same capabilities as a regular post. Therefore, if a user can edit “posts”, they can also edit your custom post type (because the capability requirement is exactly the same).

    Does that help to clarify?

    Are there any basic examples of how to write this? I’m also trying to create specific user roles for specific post types.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Custom Post Types And User Roles’ is closed to new replies.