• Resolved witters

    (@witters)


    Great plugin!

    I want to be able to restrict the permissions on certain roles to **create** new posts for CPTs. (i.e. just edit existing ones).

    See https://stackoverflow.com/questions/3235257/wordpress-disable-add-new-on-custom-post-type/16675677#16675677

    I prefer to manage my CPTs in the UI.

    Please can the UI be expanded to allow the capabilities parameter to be passed to register_post_type, e.g.

    
      'capabilities' => array(
        'create_posts' => false, // Removes support for the "Add New" function ( use 'do_not_allow' instead of false for multisite set ups )
      ),
    

    or

    
      'capabilities' => array(
        'create_posts' => "create_$cptname", // Map a meta capability for the creation permission, e.g. create_group
      ),
    

    Thanks

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    The capabilities arguments are definitely one we do not have in place in the UI, and I’m not sure we’re ever going to officially add them.

    I know I have https://github.com/tw2113/custom-post-type-ui-capabilities/ from my personal GitHub account, but I’ve never really had a chance to robustly test exactly how much coverage it offers for roles/capabilities customization, as I’ve never really had a task that needs it. So this may or may not be enough for you.

    Otherwise, the best route to take here, if you don’t want to ditch CPTUI completely, but still need to customize a bit, is going to be our filter linked to below on GitHub

    https://github.com/WebDevStudios/custom-post-type-ui/blob/1.8.2/custom-post-type-ui.php#L506-L518

    It passes the $args array that will be passed into register_post_type so the structure should all match and everything. It also passes the current slug being registered and the CPTUI array of arguments, for use with conditional setting.

    Hope this helps at least a little bit and gets you moving forward with these capability changes.

    Thread Starter witters

    (@witters)

    Thanks for the speedy and considered reply. Appreciate it.

    The cptui_pre_register_post_type filter looks perfect! Thanks

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Welcome.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Create capability for CPTs’ is closed to new replies.