How to get all capabilities

First, create [all-capabilities] shortcode. Put this code in your theme’s functions.php: function wpse_all_capabilities() { $out=”<style> .flex-columns { column-count: 4; column-gap: 3em; column-rule: 1px solid #000; } </style>”; $out .= ‘<p class=”flex-columns”>’; $users = get_users(); foreach ( $users as $user ) { if ( $user->caps[‘administrator’] ) { $allcaps = array_keys( $user->allcaps ); foreach ( $allcaps as … Read more

How to keep the capability of users and disable Gutenberg editor in WordPress?

add these lines in your ‘functions.php’, it will work //if not gutenberg reapprove posts add_filter( ‘wp_insert_post_data’, ‘re_aprove’, ’99’, 2 ); function re_aprove( $data, $postarr ) { //check if current user is not admin if ( ! current_user_can( ‘manage_options’ ) ) { if ( ‘publish’ === $data[‘post_status’] ) { $data[‘post_status’] = ‘pending’; } } return $data; … Read more

WordPress: Custom User Role cannot access Custom Post Type | “Sorry, you are not allowed to access this page”

SOLUTION: With some playing around I realized I am definitely an idiot and WAY over-thought things. While I had previously read and tried some of the things in this similar post, I ended up substituting their code for mine and found it actually worked for my use case. In trying to understand why that was, … Read more

Which capabilities are available in Gravity Forms Salesforce plugin? [closed]

Found the capabilities, most are self explanatory. <?php array( ‘vxg_salesforce_read_feeds’ => true, ‘vxg_salesforce_edit_feeds’ => true, ‘vxg_salesforce_read_logs’ => true, ‘vxg_salesforce_export_logs’ => true, ‘vxg_salesforce_read_settings’ => true, ‘vxg_salesforce_edit_settings’ => true, ‘vxg_salesforce_send_to_crm’ => true, ‘vxg_salesforce_read_license’ => true, ‘vxg_salesforce_uninstall’ => true, ); ?>

Role capabilities issue

I solved the issue! If you create a new CPT with the function register_post_type You have to add this line in the array with arguments ‘map_meta_cap’ => true, Now you can set capabilities to a role like below add_role(‘owner’, ‘Eigenaar’, array( ‘read’ => true, ‘publish_agendas’ => true, ‘edit_agenda’ => true, ‘edit_agendas’ => true, ‘delete_agenda’ => … Read more

Hiding custom theme functionality using capabilities

If what you want to do is to hide the menu items you can make use of remove_menu_page and remove_submenu_page by hooking into admin_menu. In order to hide certain links based on the user’s role (in your case, Editor): function custom_remove_menus(){ // Get current user’s data $current_user = wp_get_current_user(); $user_id = $current_user->ID; // Check user’s … Read more