I'd like to exclude admin from some changes to my site but not sure how to do it.
I have this php:
add_action('wp_dashboard_setup',
'wpse_73561_remove_all_dashboard_meta_boxes', 9999
);
function
wpse_73561_remove_all_dashboard_meta_boxes()
{
global $wp_meta_boxes;
$wp_meta_boxes['dashboard']['normal']['core'] = array();
$wp_meta_boxes['dashboard']['side']['core'] = array();
}
This works to apply changes in general but to exclude admin I tried this and added it to the first php:
add_action( 'admin_head', 'wpso_add_admin_custom_css' );
function wpso_add_admin_custom_css() {
// Bail if Admin.
if ( current_user_can( 'manage_options' ) ) {
return;
}
So what's wrong with code:
add_action( 'admin_head', 'wpso_add_admin_custom_css' );
function wpso_add_admin_custom_css() {
// Bail if Admin.
if ( current_user_can( 'manage_options' ) ) {
return;
>?
add_action('wp_dashboard_setup',
'wpse_73561_remove_all_dashboard_meta_boxes', 9999
);
function
wpse_73561_remove_all_dashboard_meta_boxes()
{
global $wp_meta_boxes;
$wp_meta_boxes['dashboard']['normal']['core'] = array();
$wp_meta_boxes['dashboard']['side']['core'] = array();
}