Skip to content

Instantly share code, notes, and snippets.

@dfinnema
Last active August 5, 2024 02:42
Show Gist options
  • Save dfinnema/2386586bfa434fa51daac2b7156d89c7 to your computer and use it in GitHub Desktop.
Save dfinnema/2386586bfa434fa51daac2b7156d89c7 to your computer and use it in GitHub Desktop.
Hide the ManageWP Worker Plugin from your clients. Upload this file in your wp-content/mu-plugins/
<?php
/*
Plugin Name: Worker Hide
Plugin URI: https://itchef.nz
Description: Hides the worker plugin
Author: IT Chef
Author URI: https://itchef.nz
*/
/*
To Install
1. Change the varible as needed below
2. Create a new foler called 'mu-plugins' in wp-content/ (it might already exist in that case move on to the next step)
3. Upload this file to 'wp-content/mu-plugins'
4. Finished
*/
// The Wordpress user ID that can see it
$worker_hide_id = 1;
add_action( 'pre_current_active_plugins', 'dfc_hide_plugins_drop' );
function dfc_hide_plugins_drop() {
if (is_admin() && (get_current_user_id()!==$worker_hide_id)) {
$slugs = array('worker/init.php');
if (empty($slugs)) {
return;
}
if (!is_array($slugs)) {
$slugs = array($slugs);
}
global $wp_list_table;
$myplugins = $wp_list_table->items;
foreach ($myplugins as $key => $val) {
if (in_array($key,$slugs)) {
unset($wp_list_table->items[$key]);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment