daily pastebin goal
41%
SHARE
TWEET

Display active plugins first

SergeyBiryukov Jan 29th, 2018 (edited) 53 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function display_active_plugins_first() {
  2.     global $wp_list_table;
  3.     uksort( $wp_list_table->items, '_order_plugins_by_status' );
  4. }
  5. add_action( 'admin_head-plugins.php', 'display_active_plugins_first' );
  6.  
  7. function _order_plugins_by_status( $plugin_a, $plugin_b ) {
  8.     if ( is_plugin_active( $plugin_b ) ) {
  9.         if ( is_plugin_active( $plugin_a ) ) {
  10.             return 0;
  11.         } else {
  12.             return 1;
  13.         }
  14.     } else {
  15.         return -1;
  16.     }
  17. }
RAW Paste Data
Pastebin PRO WINTER Special!
Get 40% OFF Pastebin PRO accounts!
Top