I use the following snippet to hide the plugins from my plugins list:
function hide_plugin_trickspanda() {
global $wp_list_table;
$hidearr = array('plugin-directory/plugin-file.php');
$myplugins = $wp_list_table->items;
foreach ($myplugins as $key => $val) {
if (in_array($key,$hidearr)) {
unset($wp_list_table->items[$key]);
}
}
}
add_action('pre_current_active_plugins', 'hide_plugin_trickspanda');
This works but when I used this on a WordPress MS, it works for all the sites, but the Network admin.
I found out that Network Admin uses active_sitewide_plugins
hook for this task, but I can't find any real way to do it.
According to this site:
FYI => I was pulling an error with a plugin I developed and ended up trolling around the bowels of WordPress, specifically WordPress multisite.
WordPress single-site has a site get_option ‘active_plugins’. For WP multisite it’s get_site_option ‘active_sitewide_plugins’. The issue is, single-site uses an array with numbers—representing plugin load order—as they key. Like this:
[0] => hello-dolly/hello.php
On the other hand, WP multisite uses an associative array with the plugin name as the key and some integer as the value. Like this:
[hello-dolly/hello.php] => 1369572703
The broader issue was to manipulate the load order of the plugins. Once I understood the array types were different I added an is_mutisite() conditional and manipulated the arrays appropriately. When I find out why the array types are different I’ll let you know.
Any ideas?