using is_super_admin() in a plugin
-
I was wondering if you could help me with a plugin I am building. I am taking some functions that we would want even if we moved to a different theme, and moving the functions to a plugin. All of the plugins work except for one, and I have narrowed it down to my use of if(!is_super_admin()){}. This is what I have:
if ( !is_super_admin() ) {
add_action( ‘wp_before_admin_bar_render’, ‘admin_bar_hide’ );
add_action(‘admin_menu’, ‘customize_admin_menu_hide’, 999);
add_action( ‘wp_before_admin_bar_render’, ‘wpse200296_before_admin_bar_render’ );
add_action(‘admin_menu’, ‘hide_acf’);
add_filter(‘tiny_mce_before_init’, ‘myformatTinyMCE’);
}If I use this in the functions.php it works fine, but if I use this in a plugin it breaks. If I remove the “if ( !is_super_admin() ) {“ I can get it to work, have you ever used is_super_admin in a plugin?
This is the error I am getting: “PHP Fatal error: Call to undefined function wp_get_current_user() in /var/www/sites/hsa-dev/wp-includes/capabilities.php on line 715”
Thanks,
Aaron
- The topic ‘using is_super_admin() in a plugin’ is closed to new replies.