You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The plugins_loaded hook is too early. That page is added on the admin_menu hook with the default priority (10), so using a later priority should do it for you:
/**
* Hide WP101 Menu from Subscribers
*/
function s9_wp101_hide_from_subscribers() {
if ( ! current_user_can( 'edit_posts' ) ) {
remove_menu_page( 'wp101' );
}
}
add_action( 'admin_menu', 's9_wp101_hide_from_subscribers', 20 );
Doh. Thanks Bill. I actually started with admin_menu, but that didn't work (was missing a later priority) so I blindly moved it to plugins_loaded thinking that was actually later...
the admin_menu, 20 combo is working.
Longer term... I think there ought to be a settings option to hide video from subscribers.
Within the context of version 5 of the WP101 plugin, the capability used to determine the visibility of the "Video Tutorials" page (defined in WP101\Admin\register_menu_pages()) should be filterable, defaulting to "read".
There needs to be an easy way to hide the videos en mass from certain user roles, particularly subscribers on membership/e-commerce sites.
I was assuming this would work, but it doesn't so I must be doing something wrong:
The text was updated successfully, but these errors were encountered: