Advertisement
swte

Hide Swift AI

Oct 8th, 2024
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.96 KB | None | 0 0
  1. // Hide the plugin from the Tools menu
  2.  add_action('admin_menu', 'hide_swift_performance_ai_menu', 999);
  3.  function hide_swift_performance_ai_menu() {
  4.      global $submenu;
  5.  
  6.      // Check if 'Tools' menu is set and if 'swift3' page is there, then unset it
  7.      if (isset($submenu['tools.php'])) {
  8.          foreach ($submenu['tools.php'] as $key => $menu_item) {
  9.              if (strpos($menu_item[2], 'swift3') !== false) {
  10.                  unset($submenu['tools.php'][$key]);
  11.              }
  12.          }
  13.      }
  14.  }
  15.  
  16.  // Hide Swift Performance AI from the Plugins page
  17.  add_filter('all_plugins', 'hide_swift_performance_ai_from_plugins');
  18.  function hide_swift_performance_ai_from_plugins($plugins) {
  19.      // Define the plugin's main file to hide
  20.      $plugin_file = 'swift-ai/main.php';
  21.  
  22.      // Unset the plugin if it exists in the plugin list
  23.      if (isset($plugins[$plugin_file])) {
  24.          unset($plugins[$plugin_file]);
  25.      }
  26.  
  27.      return $plugins;
  28.  }
  29.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement