I have some strange error or may be I do not have the skills to tackle this issue.
I am building a plugin for Multisite. When is use is_admin()
, my plugin works fine but when I use is_super_admin
it shows me this error Fatal error: Call to undefined function wp_get_current_user()
. I did my search but could not be able to find any solution.
My Code is this
if(!is_super_admin()){
add_action('widgets_init','my_unregister_widdget');
function my_unregister_widgets() {
unregister_widget( 'WP_Widget_Pages' );
unregister_widget( 'WP_Widget_Calendar' );
}
}
I saw this question but it's not helping me.
is_admin()
checks if you are in back or front end, it has nothing to do with the user being "admin". Opposed tois_super_admin()
, which indeed checks for the user role. Also, please don't Multi-post the same Question in different Stack sites.