Can't get custom capabilities to apply.
-
I created a custom post type and used
capability_type
to add custom capabilities to it. I’m trying to apply the capabilities to the administrator role, but it’s not working. When I runvar_dump( current_user_can( 'publish_my_custom_post' ) );
it keeps returning false. Here is the code that adds the capabilities, any idea what’s wrong with it?// Hook to call function to add capabilities add_action( 'plugins_loaded', 'ca_myplugin_caps'); // tried admin_init also // Function to assign capabilities. function ca_myplugin_caps() { // Get the administrator role. $role = get_role( 'administrator' ); // Add the capabilities to the role. $role->add_cap( 'publish_my_custom_post' ); }
[ mod note: do not bump ]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Can't get custom capabilities to apply.’ is closed to new replies.