[wp-trac] [WordPress Trac] #60495: Following "plugins_list": Add a filter in get_views() in class-wp-plugins-list-table

WordPress Trac noreply at wordpress.org
Mon Jun 16 14:04:18 UTC 2025


#60495: Following "plugins_list": Add a filter in get_views() in class-wp-plugins-
list-table
-----------------------------------------+---------------------
 Reporter:  juliobox                     |       Owner:  (none)
     Type:  enhancement                  |      Status:  new
 Priority:  normal                       |   Milestone:  6.9
Component:  Plugins                      |     Version:  6.3
 Severity:  normal                       |  Resolution:
 Keywords:  has-patch changes-requested  |     Focuses:
-----------------------------------------+---------------------

Comment (by mindctrl):

 Current patches are passing `$status` as the third parameter to the
 filter, but I think the intent was for it to be `$type`, otherwise you
 can't act on `my_plugin` as the example shows.

 Also the example for filtering `plugins_list` is incorrect, as it lacks
 the folder/file slug key when adding to `$plugins['my_plugins']`. This
 causes count errors.

 Example filter code should look something like this:

 {{{#!php
 <?php
 add_filter( 'plugins_list', 'my_plugins_tab' );
 function my_plugins_tab( $plugins ) {
         $plugins['my_plugins']['test-reports/test-reports.php'] =
 $plugins['all']['test-reports/test-reports.php'];
         return $plugins;
 }

 add_filter( 'plugins_list_status_text', 'my_plugins_tab_label', 10, 3 );
 function my_plugins_tab_label( $text, $count, $type ) {
     if ( 'my_plugins' === $type ) {
         $text = _nx( 'My Plugin', 'My Plugins', $count, 'domain' );
     }
     return $text;
 }
 }}}


 Even with the above fixes, the query doesn't work properly when navigating
 to the My Plugins view. All plugins are shown instead of a filtered view.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/60495#comment:20>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list