Make WordPress Core


Ignore:
Timestamp:
10/04/2022 03:45:37 AM (3 years ago)
Author:
peterwilsoncc
Message:

Administration: Remove private delegation from list tables.

Remove the private delegation from the following classes and function:

  • WP_List_Table
  • WP_Application_Passwords_List_Table
  • WP_Comments_List_Table
  • WP_Links_List_Table
  • WP_Media_List_Table
  • WP_MS_Sites_List_Table
  • WP_MS_Themes_List_Table
  • WP_MS_Users_List_Table
  • WP_Plugin_Install_List_Table
  • WP_Plugins_List_Table
  • WP_Post_Comments_List_Table
  • WP_Posts_List_Table
  • WP_Terms_List_Table
  • WP_Theme_Install_List_Table
  • WP_Themes_List_Table
  • WP_Users_List_Table
  • _get_list_table()

This change is to reflect the reality that list tables are very, very, very widely used by extenders and backward compatibility therefore needs to be maintained.

Introduces the filter wp_list_table_class_name within _get_list_table() to allow extenders to modify the list table returned for custom screens.

Props audrasjb, birgire, costdev, desrosj, faison, johnbillion, jrbeilke, kurtpayne, milana_cap, miqrogroove, nacin, peterwilsoncc, scribu, sergeybiryukov, sirzooro, westonruter, wonderboymusic.
Fixes #18449.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/list-table.php

    r53185 r54378  
    1111 * Fetches an instance of a WP_List_Table class.
    1212 *
    13  * @access private
    1413 * @since 3.1.0
    1514 *
     
    5958        }
    6059
     60        /**
     61         * Filters the list table class to instantiate.
     62         *
     63         * @since 6.1.0
     64         *
     65         * @param string $class_name The list table class to use.
     66         * @param array  $args       An array containing _get_list_table() arguments.
     67         */
     68        $custom_class_name = apply_filters( 'wp_list_table_class_name', $class_name, $args );
     69
     70        if ( is_string( $custom_class_name ) && class_exists( $custom_class_name ) ) {
     71            $class_name = $custom_class_name;
     72        }
     73
    6174        return new $class_name( $args );
    6275    }
Note: See TracChangeset for help on using the changeset viewer.