Custom post types as sub menu pages and role capabilities issue
Custom post types as sub menu pages and role capabilities issue
Custom post types as sub menu pages and role capabilities issue
You can add a condition on capabilities in order to exclude the admin from the unset action for example add_filter( ‘post_row_actions’, ‘remove_row_actions’, 10, 2 ); function remove_row_actions_staff( $actions, $post ){ //This line stops function execution if user has some admin capabilities if( current_user_can( ‘administrator’ ) ): return $actions; endif; if( $post->post_type() === ‘wiki-testimonials’ ) unset( … Read more
There’s no such hook named load-themes.php in WordPress. One of the hooks you can use to add custom capabilities is after_setup_theme. Also, there’s no need to use ‘themes.php’ == $pagenow && isset($_GET[‘activated’]) condition there. What are you trying to achieve this way? Try to use this code instead: add_action( ‘after_setup_theme’, function() { $role = get_role( … Read more
Upon further searching and after discovering the $submenu global variable, I’ve managed to find a helpful tutorial on removing sub-menus from the WordPress admin. I’ll post with code when I get a full solution implemented and integrated with the plugin.
You can use user_has_cap filter to check and grant capabilities dynamically. add_filter(‘user_has_cap’, ‘contributor_can_edit_published_posts’, 10, 4); function contributor_can_edit_published_posts($allcaps, $caps, $args, $user) { global $post; // Do we have a post? if ( ! $post ) { return $allcaps; } // Is the user a contributor? if ( ! isset( $allcaps[‘contributor’] ) || true !== $allcaps[‘contributor’] ) … Read more
You should be posting your data (via <form action=”” …> to your theme options page, rather than to the wp-admin/options.php file. The latter is for the stuff under Settings. Also, I don’t mean to be tossing dirt at anyone in particular, but always take the tips that you read on the web with a grain … Read more
Use ‘capability_type’ & ‘capabilities’ when you register_post_type().
You don’t need to send any additional data, since the user cookies (which are used for authentication) will be sent by default. You have access to all the WP functions, including current_user_can().
Activate the plugin again, reset your caps to default. I guess the problem is the plugin – not wp. Maybe it misses to add some capability. Best would be to try to take a look at the capabilites that are assigned to the different roles. How-to inspect current user data the smart way Create an … Read more
You need to check out codex page regarding roles and caps to see the list of default capabilites that exist, you can always create your own custom capabilites