On this page
_get_list_table( string $class_name, array $args = array() ): WP_List_Table|false
Fetches an instance of a WP_List_Table class.
Parameters
$class_namestring Required-
The type of the list table, which is the class name.
$argsarray Optional-
Arguments to pass to the class. Accepts
'screen'.Default:
array()
Return
WP_List_Table|false List table object on success, false if the class does not exist.
Source
File: wp-admin/includes/list-table.php. View all references
function _get_list_table( $class_name, $args = array() ) {
$core_classes = array(
// Site Admin.
'WP_Posts_List_Table' => 'posts',
'WP_Media_List_Table' => 'media',
'WP_Terms_List_Table' => 'terms',
'WP_Users_List_Table' => 'users',
'WP_Comments_List_Table' => 'comments',
'WP_Post_Comments_List_Table' => array( 'comments', 'post-comments' ),
'WP_Links_List_Table' => 'links',
'WP_Plugin_Install_List_Table' => 'plugin-install',
'WP_Themes_List_Table' => 'themes',
'WP_Theme_Install_List_Table' => array( 'themes', 'theme-install' ),
'WP_Plugins_List_Table' => 'plugins',
'WP_Application_Passwords_List_Table' => 'application-passwords',
// Network Admin.
'WP_MS_Sites_List_Table' => 'ms-sites',
'WP_MS_Users_List_Table' => 'ms-users',
'WP_MS_Themes_List_Table' => 'ms-themes',
// Privacy requests tables.
'WP_Privacy_Data_Export_Requests_List_Table' => 'privacy-data-export-requests',
'WP_Privacy_Data_Removal_Requests_List_Table' => 'privacy-data-removal-requests',
);
if ( isset( $core_classes[ $class_name ] ) ) {
foreach ( (array) $core_classes[ $class_name ] as $required ) {
require_once ABSPATH . 'wp-admin/includes/class-wp-' . $required . '-list-table.php';
}
if ( isset( $args['screen'] ) ) {
$args['screen'] = convert_to_screen( $args['screen'] );
} elseif ( isset( $GLOBALS['hook_suffix'] ) ) {
$args['screen'] = get_current_screen();
} else {
$args['screen'] = null;
}
/**
* Filters the list table class to instantiate.
*
* @since 6.1.0
*
* @param string $class_name The list table class to use.
* @param array $args An array containing _get_list_table() arguments.
*/
$custom_class_name = apply_filters( 'wp_list_table_class_name', $class_name, $args );
if ( is_string( $custom_class_name ) && class_exists( $custom_class_name ) ) {
$class_name = $custom_class_name;
}
return new $class_name( $args );
}
return false;
}
Hooks
- apply_filters( 'wp_list_table_class_name',
string $class_name ,array $args ) -
Filters the list table class to instantiate.
Related
Uses
| Uses | Description |
|---|---|
| get_current_screen() wp-admin/includes/screen.php | Get the current screen object |
| convert_to_screen() wp-admin/includes/template.php | Converts a screen string to a screen object. |
| apply_filters() wp-includes/plugin.php | Calls the callback functions that have been added to a filter hook. |
Used By
| Used By | Description |
|---|---|
| wp_ajax_search_install_plugins() wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins to install. |
| wp_ajax_search_plugins() wp-admin/includes/ajax-actions.php | Ajax handler for searching plugins. |
| display_theme() wp-admin/includes/theme-install.php | Prints a theme on the Install Themes pages. |
| display_themes() wp-admin/includes/theme-install.php | Displays theme content based on theme list. |
| install_theme_information() wp-admin/includes/theme-install.php | Displays theme information in dialog box form. |
| wp_plugin_update_row() wp-admin/includes/update.php | Displays update information for a plugin. |
| wp_theme_update_row() wp-admin/includes/update.php | Displays update information for a theme. |
| wp_dashboard_recent_comments() wp-admin/includes/dashboard.php | Show Comments section. |
| wp_comment_reply() wp-admin/includes/template.php | Outputs the in-line comment reply-to form in the Comments list table. |
| wp_ajax_add_user() wp-admin/includes/ajax-actions.php | Ajax handler for adding a user. |
| wp_ajax_inline_save() wp-admin/includes/ajax-actions.php | Ajax handler for Quick Edit saving a post from a list table. |
| wp_ajax_inline_save_tax() wp-admin/includes/ajax-actions.php | Ajax handler for quick edit saving for a term. |
| wp_ajax_add_tag() wp-admin/includes/ajax-actions.php | Ajax handler to add a tag. |
| wp_ajax_get_comments() wp-admin/includes/ajax-actions.php | Ajax handler for getting comments. |
| wp_ajax_replyto_comment() wp-admin/includes/ajax-actions.php | Ajax handler for replying to a comment. |
| wp_ajax_edit_comment() wp-admin/includes/ajax-actions.php | Ajax handler for editing a comment. |
| wp_ajax_fetch_list() wp-admin/includes/ajax-actions.php | Ajax handler for fetching a list table. |
| post_comment_meta_box() wp-admin/includes/meta-boxes.php | Displays comments for post. |
Changelog
| Version | Description |
|---|---|
| 3.1.0 | Introduced. |
© 2003–2022 WordPress Foundation
Licensed under the GNU GPLv2+ License.
https://developer.wordpress.org/reference/functions/_get_list_table