Hide the Wordfence Dashboard Widget From Non-Admins
Removes Wordfence's activity report widget from the dashboard for editors and other roles, keeping their dashboard focused on content.
Opens WPIDE on
Code
$wpide_everyone = false; // true = hide for all users.
add_action( 'wp_dashboard_setup', function () use ( $wpide_everyone ) {
if ( ! defined( 'WORDFENCE_VERSION' ) ) {
return;
}
if ( $wpide_everyone || ! current_user_can( 'manage_options' ) ) {
remove_meta_box( 'wordfence_activity_report_widget', 'dashboard', 'normal' );
}
}, 999 );
Notes
Set $wpide_everyone to true to hide it for administrators as well.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.