My plugin code looks like below,
if (!current_user_can('administrator')){
function hide_post_page_options() {
//global $post;
// Set the display css property to none for add category and add tag functions
$hide_post_options = "<style type="text/css"> .jaxtag { display: none; } #category-adder { display: none; } </style>";
print($hide_post_options);
}
add_action( 'admin_head', 'hide_post_page_options' );
}
But when I activate I get an error
Fatal error: Call to undefined function wp_get_current_user()
I could get around this by including the pluggable.php in capabilities.php. But I don’t think doing a change in those files is a better way. Because wp_get_current_user() is a pluggable function it is only available after the plugins are loaded. Is there a way to use this without making changed to core files?
Instead of hiding it with CSS, I would suggest you to remove it from Menu if it’s not admin, that would be a WordPress approach