Bricks Version: 1.5.4
Using Bricks Editor Access settings does not work. If I set that on “only the administrator can use Bricks” it still makes the Bricks menu item appear to the other user roles.
I tried to solve differently using a function in function.php
add_action('admin_init', 'my_remove_menu_pages');
function my_remove_menu_pages() {
if (!current_user_can('manage_options')) {
remove_menu_page('bricks');
}
}
it’s works but in this way the php log file is filled with warnings as reported also by a user on the pages of the wordpress codex (remove_menu_page() – Function | Developer.WordPress.org ) —(the last comment) who basically says that the function remove_menu_page (‘slug’); it must not be used in conjunction with the admin_init but with the admin_menu.
so i tried to modify my function with this one below
add_action('admin_menu', 'my_remove_menu_pages');
function my_remove_menu_pages() {
$user = wp_get_current_user();
if ( !in_array( 'administrator', (array) $user->roles ) ) {
remove_menu_page('bricks');
}
}
even so, however, the bricks menu continues to be seen.
How can I solve the problem?