Hi, I have the paid version of the plugin and am trying to implement the code for “Restrict the list of parent pages” found on this page: https://www.role-editor.com/restrict-the-list-of-parent-pages/ – this will remove the items from the main menu correct?
I’m having problems finding the IDs to replace the 10,2 found on the first line. Also do I enter in the role name by current_user_can?
add_filter('page_attributes_dropdown_pages_args', 'restrict_parent_pages_for_role', 10, 2);
function restrict_parent_pages_for_role($args, $post) {
if (current_user_can('mynewrole')) {
// list of pages to exclude from the parent pages dropdown menu. Do not use with 'include' together.
$args['exclude'] = array(47);
}
return $args;
}
This code removes items from the list of parent pages at the ‘Page Attributes’ meta box placed to the right at the page editor screen. It does not related to any ‘main menu’.
If you name ‘main menu’ the menu to the left at the WordPress wp-admin, then use ‘Admin menu’ access add-on to block/hide that menu items from users: https://www.role-editor.com/block-admin-menu-items
You don’t need any additional code for that.
If you write about some other menu, please clarify what menu do you mean.