How can I hide the options pages that I add so that only the super admin can see them?
thanks!
Hi kkyang,
You can do so by editing the capability of the options page.
Set it to a capability only a super admin has
For example:
$options = acf_add_options_page(array(
"page_title" => "Options",
"menu_title" => "Options",
"menu_slug" => "options-theme",
"capability" => "manage_sites",
"redirect" => false
));
For more capabilities see:
http://codex.wordpress.org/Roles_and_Capabilities#Capability_vs._Role_Table
sweet! is there anything wrong with doing it this way?
if (current_user_can('administrator')) {
if(function_exists('acf_add_options_page')) {
acf_add_options_page();
acf_add_options_sub_page('Global');
acf_add_options_sub_page('Home');
acf_add_options_sub_page('Ads');
acf_add_options_sub_page('Social Media Widget');
acf_add_options_sub_page('Calendar Options');
}
}
I can’t speak to the functions above, but if you’re looking to do a lot of admin sidebar tweaking, look into the Admin Menu Editor plugin https://wordpress.org/plugins/admin-menu-editor. Allows for resorting, hiding, adding, and all sorts of editing to the admin menu. Great for handing off to less-savvy users.