Make WordPress Core

Ticket #58824: 58824-1.patch

File 58824-1.patch, 2.8 KB (added by iflairwebtechnologies, 9 months ago)
  • src/wp-admin/includes/class-wp-posts-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-posts-list-table.php b/src/wp-admin/includes/class-wp-posts-list-table.php
    index 1c6ae83119..53dcf23f80 100644
    a b class WP_Posts_List_Table extends WP_List_Table { 
    637637         * @return array
    638638         */
    639639        protected function get_table_classes() {
    640                 global $mode;
    641 
    642                 $mode_class = esc_attr( 'table-view-' . $mode );
    643 
    644                 return array(
    645                         'widefat',
    646                         'fixed',
    647                         'striped',
    648                         $mode_class,
    649                         is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts',
    650                 );
     640            global $mode;
     641
     642            // Sanitize the mode class name
     643            $mode_class = esc_attr( 'table-view-' . $mode );
     644
     645            // Get the post type
     646            $post_type = $this->screen->post_type;
     647
     648            // Sanitize the post type class name
     649            $post_type_class = esc_attr( 'post-type-' . $post_type );
     650
     651            // Determine if the post type is hierarchical
     652            $post_type_hierarchical_class = is_post_type_hierarchical( $post_type ) ? 'pages' : 'posts';
     653
     654            // Return the array of classes
     655            $classes = array(
     656                'widefat',
     657                'fixed',
     658                'striped',
     659                $mode_class,
     660                $post_type_class,
     661                $post_type_hierarchical_class,
     662            );
     663            return apply_filters( 'wp_list_table_classes', $classes, $this );
    651664        }
    652665
    653666        /**