I need to remove the Premmerce plugin menu item from the admin menu (leaving it visible only to the admin and hidden for all other roles).
I had the same problem with the JetPack menu item which I fixed by adding this code to the functions.php file:
function ap_remove_jetpack_page( ) {
if ( class_exists( 'Jetpack' ) && !current_user_can( 'manage_options' ) ) {
remove_menu_page( 'jetpack' );
}
}
add_action( 'admin_menu', 'ap_remove_jetpack_page', 999 );
I would like to do the same for the Premmerce menu item. How can I do?
Thankyou
2
Answers
If you are using the main
premmerce
plugin then you can use following code.Actually you don’t need to check this statement
current_user_can
is enough.What you need is to know the slug this can be done by following those steps from the extension search page
more details
WordPress.org extension page
You can test with other plugins to verify if the behaviour is still correct.
Sources