ovizii
4/2/2014 - 10:10 AM

Hide plugins to prevent them being disabled

Hide plugins to prevent them being disabled

<?php
/*
Plugin Name: ICTPC
Description: Hide certain plugins from the list to prevent disabling. Needed for managed hosting by ovi.
Version: 1.0
Author: Ovidiu Pacuraru
License: GPL2
*/
add_action( 'pre_current_active_plugins', 'hide_plugins' );

//test hiding plugins
function hide_plugins() {
  global $wp_list_table;
  $hidearr = array('adminer/adminer.php', 'adminimize/adminimize.php', 'cloudflare/cloudflare.php', 'iwp-client/init.php', 'nginx-helper/nginx-helper.php', 'tribe-object-cache/tribe-object-cache.php','wordfence/wordfence.php', 'wp-postviews/wp-postviews.php');
  $myplugins = $wp_list_table->items;
  foreach ($myplugins as $key => $val) {
    if (in_array($key,$hidearr)) {
      unset($wp_list_table->items[$key]);
    }
  }
}

//how to load plugins inside folders within mu-plugins
//include 'inspector/inspector.php';

?>