New answers tagged

0

My problem was the same and here that worked for me: Add this line to capabilities: $role->add_cap('create_notes'); And this plugin is very useful to clear custom rules and capabilities when you modify somthing and changes don't apply: Reset roles and capabilities Plus you can try this plugin: https://wordpress.org/plugins/capability-manager-enhanced/


0

This is not possible using the capabilities system, the granularity you want does not exist in WP core: edit_posts Since 2.0 Allows access to Administration Screens options: Posts Posts > Add New Comments Comments > Awaiting Moderation https://wordpress.org/support/article/roles-and-capabilities/#edit_posts edit_posts covers both viewing, adding, ...


2

You have to register custom capabilities and then apply inside the register post type function function register_website_caps() { $admins = get_role( 'administrator' ); $admins->add_cap( 'edit_website' ); $admins->add_cap( 'read_website' ); $admins->add_cap( 'delete_website' ); $admins->add_cap( 'edit_websites' ); $...


1

Working Example in Oct 2020, Working answer, I went to different answers none of them works now in new WordPress. function hide_categories_for_specific_user( $exclusions, $args ){ if ( ((defined( 'REST_REQUEST' ) && REST_REQUEST) or $GLOBALS['pagenow'] === 'edit.php' ) && !current_user_can( 'manage_options' ) ) { // IDs of terms to be ...


0

You should use : translate_user_role( __('some','textdomains ') ); example : add_role( 'wdcp_developer_role', translate_user_role( __('Developer',$this->textdomains ) ), array( 'read' => true, 'level_12' => true ) ); https://developer.wordpress.org/reference/functions/remove_role/ https://developer.wordpress.org/reference/functions/...


0

If you use other plugins you need to read the documentation on how to set role. In my case, I used Ultimate Member so I have to add these lines: UM()->roles()->set_role( $user_id, $user_role ); //and then clear the user cache after updating the role: UM()->user()->remove_cache( $user_id );


Top 50 recent answers are included