I have a multisite installation with eight instances, with the first being the “main” website of an ecosystem.
I need to add the the wp super cache settings capability to the editor and administrator roles in every “child” site.
at the moment wp super cache settings are not visible, nor accessible to other roles than the superadministrator.
the issue is that the “main” site has some custom post types that I make accessible to the “children” websites. once a post i created, i need the editors and administrator to access the “Delete Cache On All Blogs” button inside the settings.
I tried this code with no success:
function custom_grant_cache_access() {
$admin_role = get_role('administrator');
if ($admin_role) {
$admin_role->add_cap('wp_cache_manage_options');
}
}
add_action('admin_init', 'custom_grant_cache_access');
function custom_cache_menu_access() {
if (current_user_can('administrator')) {
add_menu_page('WP Super Cache', 'WP Super Cache', 'wp_cache_manage_options', 'wp-cache', '', 'dashicons-admin-generic', 56);
}
}
add_action('network_admin_menu', 'custom_cache_menu_access');
is it possible in some way? or do you plan to update the plugin with this feature?
]]>I try this (the second) but it doesn’t recognize the activation and removes caps anyway.
My function:
function add_theme_caps()
{
global $pagenow;
$role = get_role('administrator');
if ('themes.php' == $pagenow && isset($_GET['activated'])) { // Test if theme is active
$caps = array(
'activate_plugins',
);
foreach ($caps as $cap) {
$role->add_cap($cap);
}
} else {
$caps = array(
'activate_plugins',
);
foreach ($caps as $cap) {
$role->remove_cap($cap);
}
}
}
add_action('load-themes.php', 'add_theme_caps');
Can you help me?
Thanks.
PS: my original issue is about adding cpt custom caps
]]>You can try it here: https://www.queengnails.com/
Thank you anyone.
Gianluca.
wp-content/plugins/wpfront-user-role-editor-personal-pro/includes/ppro/extended-permissions/class-extend-post-type.php:168
WPFront\U\P\E\WPFront_User_Role_Editor_Extend_Post_Type->set_cap()
wp-content/plugins/wpfront-user-role-editor-personal-pro/includes/ppro/extended-permissions/class-extend-post-type.php:113
WPFront\U\P\E\WPFront_User_Role_Editor_Extend_Post_Type->__construct()
wp-content/plugins/wpfront-user-role-editor-personal-pro/includes/ppro/extended-permissions/class-post-type-extended-permissions-pro.php:181
WPFront\U\P\E\WPFront_User_Role_Editor_Post_Type_Extended_Permissions_Pro->register()
wp-content/plugins/wpfront-user-role-editor-personal-pro/includes/ppro/extended-permissions/class-post-type-extended-permissions-pro.php:160
WPFront\U\P\E\WPFront_User_Role_Editor_Post_Type_Extended_Permissions_Pro->register_extend()
wp-includes/class-wp-hook.php:303
do_action('registered_post_type')
wp-includes/post.php:1539
register_post_type()
wp-includes/post.php:41
create_initial_post_types()
wp-includes/class-wp-hook.php:303
do_action('init')
wp-settings.php:578
and after investigation, i have found that this option in “extended_permissions_role_permissions_processed_capabilities”
is saved wrongly with value “10k”
need help to know why this issue happened
Best Regards
I do not want the text to wrap to the left and under the drop cap.
]]>when added on a multisite, the latest version (6.5.0) of the plugin causes a fatal error on admin pages (example dashboard page) but not on all sites:
Fatal error: Uncaught Error: Call to a member function has_cap() on null in wp-content/plugins/breadcrumb-navxt/includes/class.mtekk_adminkit.php:73
This is very strange because the plugin is not even activated.
Any idea?
Meanwhile, I changed to the previous version (6.4.0) and it’s working great.
]]>