[wp-trac] [WordPress Trac] #58824: Add a filter to change the classes in posts list table in admin

WordPress Trac noreply at wordpress.org
Thu Aug 1 13:24:05 UTC 2024


#58824: Add a filter to change the classes in posts list table in admin
-------------------------------------+-------------------------------------
 Reporter:  zahardoc                 |       Owner:  (none)
     Type:  enhancement              |      Status:  new
 Priority:  normal                   |   Milestone:  Awaiting Review
Component:  General                  |     Version:
 Severity:  normal                   |  Resolution:
 Keywords:  good-first-bug has-      |     Focuses:  ui, css,
  patch                              |  administration
-------------------------------------+-------------------------------------

Comment (by iflairwebtechnologies):

 @zahardoc
 You can review, added new patch 58824-1.patch with the updated code
 You can use a filter like below in the theme functions.php file and check


 {{{
 function my_custom_list_table_classes( $classes, $list_table ) {
     // Add a custom class
     $classes[] = 'my-custom-class';

     // Remove a class if needed
     $key = array_search( 'some-existing-class', $classes );
     if ( $key !== false ) {
         unset( $classes[$key] );
     }

     return $classes;
 }

 add_filter( 'wp_list_table_classes', 'my_custom_list_table_classes', 10, 2
 );
 }}}

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


More information about the wp-trac mailing list