_get_list_table( string $class_name, array $args = array() ): WP_List_Table|false
- Since
- 3.1.0
- Source
wp-admin/includes/list-table.php:21
Compatibility
- WordPress
- since 3.1.0
- PHP
- 7.4–8.6-dev
- 6.7.7
- 6.8.8
- 6.9.7
- 7.0.4
- 7.1.0
Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.
Parameters
$class_namestring- The type of the list table, which is the class name.
$argsarrayoptional- Arguments to pass to the class. Accepts 'screen'.Default:
array()
Return value
WP_List_Table|false- List table object on success, false if the class does not exist.
Performance profile
How much work a call to _get_list_table() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.
- Cost class
- Light
- Scaling
- Scales with input
- Instructions
- 6–36
- Plugin surface
- 1 hook
- Called by
- 18
Touches nothing outside its own arguments.
The body loops, so the work grows with what you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 52.
Third-party callbacks on 'wp_list_table_class_name' run inside this call, and their cost is not bounded by anything here.
18 places in core call this, so the cost is paid more often than your own code shows.
What it touches
- hookthird-party callbacks
apply_filters()called directly
Further down the call graph this can also reach query, option, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.
What one call costs · 4 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost _get_list_table() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
!isset($core_classes[$class_name]) | 6 | none |
isset($core_classes[$class_name]) && !isset($args) && !isset($value) | 28–32 | apply_filters() |
isset($core_classes[$class_name]) && !isset($args) && isset($value) | 31–35 | get_current_screen(), apply_filters() |
isset($core_classes[$class_name]) && isset($args) | 32–36 | convert_to_screen(), apply_filters() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 52 | 6–36 | 7 | |
| 8.5 | 52 | 6–36 | 7 | |
| 8.4 | 52 | 6–36 | 7 | 2 fewer instructions than PHP 8.3 |
| 8.3 | 54 | 6–38 | 7 | |
| 8.2 | 54 | 6–38 | 7 | |
| 8.1 | 54 | 6–38 | 7 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 55 | 6–38 | 7 |
An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.
Hooks and filters fired · 1
One hook fires while _get_list_table() runs, in this order:
- apply_filters( wp_list_table_class_name )filterline 68 (+47 into the body)
Filters the list table class to instantiate.
Uses · 3
- convert_to_screen()Converts a screen string to a screen object.
- get_current_screen()Get the current screen object
- apply_filters()Calls the callback functions that have been added to a filter hook.
Used by · 18
- display_theme()Prints a theme on the Install Themes pages.
- display_themes()Displays theme content based on theme list.
- install_theme_information()Displays theme information in dialog box form.
- post_comment_meta_box()Displays comments for post.
- wp_ajax_add_tag()Handles adding a tag via AJAX.
- wp_ajax_add_user()Handles adding a user via AJAX.
- wp_ajax_edit_comment()Handles editing a comment via AJAX.
- wp_ajax_fetch_list()Handles fetching a list table via AJAX.
- wp_ajax_get_comments()Handles getting comments via AJAX.
- wp_ajax_inline_save()Handles Quick Edit saving a post from a list table via AJAX.
- wp_ajax_inline_save_tax()Handles Quick Edit saving for a term via AJAX.
- wp_ajax_replyto_comment()Handles replying to a comment via AJAX.
Show all 18
- wp_ajax_search_install_plugins()Handles searching plugins to install via AJAX.
- wp_ajax_search_plugins()Handles searching plugins via AJAX.
- wp_comment_reply()Outputs the in-line comment reply-to form in the Comments list table.
- wp_dashboard_recent_comments()Show Comments section.
- wp_plugin_update_row()Displays update information for a plugin.
- wp_theme_update_row()Displays update information for a theme.
Source code
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;}Changelog
Introduced in 3.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
About this page
- Parsed data
- Generated from the wordpress-develop 7.1.0 tag, from
src/wp-admin/includes/list-table.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it. - Corrections
- Something wrong on this page? Report it and it gets fixed in the next regeneration.