Skip Navigation

[Geschlossen] Feature Request: Include capability_type on type def

This support ticket is created vor 11 Jahre. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

This topic contains 5 Antworten, has 4 Stimmen.

Last updated by Matthew vor 10 Jahre, 8 Monate.


I wonder if you have plans to add the capability_type on the post type definition screen(?)

I rely on these capabilities to control edit/publish/delete access to my post types, so I had to "hack" your plug-in to get them in.

Only two files need to be altered:
custom-types-form.php (to display entry field and save to db)
in wpcf_admin_custom_types_form()
<blockquote cite="wpcf_admin_custom_types_form()">
$form['capability_type'] = array(
'#type' => 'textfield',
'#name' => 'ct[capability_type]',
'#title' => __('Capability Type', 'wpcf'),
'#description' => __('Capability +root+. New capabilities will be generated by register_post_type() with +root+ in place of +post+.',
'#value' => isset($ct['capability_type']) ? $ct['capability_type'] : '',
'#inline' => true,

custom-types.php (to include it on the default properties of a type)

add an array element to the array returned by wpcf_custom_types_default() like so:
<blockquote cite="wpcf_custom_types_default()">
'public' => true,
'capability_type' => 'post',
'menu_position' => null,

only the middle line is new. There is no real need for it. Just to keep things consistent.

WP automatically adds new capabilities to custom post types registered with the following names:

anything placed on the "capability_type" would create custom capabilities.
For example if we use "listing" as our capability type, WP generates capabilities like:
and so on.
Then we only need to add those capabilities to which ever role will be in charge of managing the "listings"

If you wanna get fancy you could go a step further and let the person defining the new post type, define the capabilities name as well (without relying on WP's template).

thx in advance.


Thanks for the detailed infomation. We'll investigate and add it to Types.


Thanks for your consideration. I'll bug you again a couple of months down the road if it doesn't make it into the plugin by then :0)


Just a clarification:
The line
'capability_type' => 'post',

'capabilities' => false,

I wrote above that this was a new line and that i wasn't that important. In fact, removing the 'capabilities'=>false is required.
I just noticed this while going through the exercise of adding the capabilities again after updating to

(no need to respond, really!!)



+1 for this addition.

I'd also like to add the ability to assign the custom capability to roles through Types.

I added and changed 2 lines of code to automatically create a new capability using the cpt slug. I had to use Map Cap to assign this new capability to a role, but it would awesome to have it all in one place. This way you could really customize and control access to the post type.


Big +1

Das Thema „[Geschlossen] Feature Request: Include capability_type on type def“ ist für neue Antworten geschlossen.