WP_Posts_List_Table::extra_tablenav( string $which )
- Source
wp-admin/includes/class-wp-posts-list-table.php:567
Compatibility
- WordPress
- core
- 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
$whichstring
Performance profile
How much work a call to WP_Posts_List_Table::extra_tablenav() 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
- Trivial
- Scaling
- Constant
- Instructions
- 12–81
- Plugin surface
- 2 hooks
- Called by
- 0
Touches nothing outside its own arguments.
No loop in the body: the same number of instructions runs whatever you pass in.
Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 81.
Third-party callbacks on 'restrict_manage_posts', 'manage_posts_extra_tablenav' run inside this call, and their cost is not bounded by anything here.
Nothing in core calls this; the cost is only what you spend yourself.
What it touches
- hookthird-party callbacks
do_action()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 · 12 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Posts_List_Table::extra_tablenav() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
$which !== "top" | 12 | do_action() |
$which !== "top" && !->has_items() | 15 | ->has_items(), do_action() |
$which !== "top" && ->has_items() && !current_user_can() | 28 | ->has_items(), get_post_type_object(), current_user_can(), do_action() |
$which !== "top" && ->has_items() && current_user_can() | 37 | ->has_items(), get_post_type_object(), current_user_can(), __(), submit_button(), do_action() |
$which === "top" && empty($output) | 45 | ob_start(), ->months_dropdown(), ->categories_dropdown(), ->formats_dropdown(), do_action(), ob_get_clean(), do_action() |
$which === "top" && empty($output) && !->has_items() | 48 | ob_start(), ->months_dropdown(), ->categories_dropdown(), ->formats_dropdown(), do_action(), ob_get_clean(), ->has_items(), do_action() |
$which === "top" && !empty($output) | 56 | ob_start(), ->months_dropdown(), ->categories_dropdown(), ->formats_dropdown(), do_action(), ob_get_clean(), __(), submit_button(), do_action() |
$which === "top" && !empty($output) && !->has_items() | 59 | ob_start(), ->months_dropdown(), ->categories_dropdown(), ->formats_dropdown(), do_action(), ob_get_clean(), __(), submit_button(), ->has_items(), do_action() |
$which === "top" && empty($output) && ->has_items() && !current_user_can() | 61 | ob_start(), ->months_dropdown(), ->categories_dropdown(), ->formats_dropdown(), do_action(), ob_get_clean(), ->has_items(), get_post_type_object(), current_user_can(), do_action() |
$which === "top" && empty($output) && ->has_items() && current_user_can() | 70 | ob_start(), ->months_dropdown(), ->categories_dropdown(), ->formats_dropdown(), do_action(), ob_get_clean(), ->has_items(), get_post_type_object(), current_user_can(), __(), submit_button(), do_action() |
$which === "top" && !empty($output) && ->has_items() && !current_user_can() | 72 | ob_start(), ->months_dropdown(), ->categories_dropdown(), ->formats_dropdown(), do_action(), ob_get_clean(), __(), submit_button(), ->has_items(), get_post_type_object(), current_user_can(), do_action() |
$which === "top" && !empty($output) && ->has_items() && current_user_can() | 81 | ob_start(), ->months_dropdown(), ->categories_dropdown(), ->formats_dropdown(), do_action(), ob_get_clean(), __(), submit_button(), ->has_items(), get_post_type_object(), current_user_can(), __(), submit_button(), do_action() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 81 | 12–81 | 5 | |
| 8.5 | 81 | 12–81 | 5 | |
| 8.4 | 81 | 12–81 | 5 | |
| 8.3 | 81 | 12–81 | 5 | |
| 8.2 | 81 | 12–81 | 5 | |
| 8.1 | 81 | 12–81 | 5 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 82 | 12–82 | 5 |
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 · 2
2 hooks fire while WP_Posts_List_Table::extra_tablenav() runs, in this order:
- do_action( restrict_manage_posts )actionline 593 (+26 into the body)
Fires before the Filter button on the Posts and Pages list tables.
- do_action( manage_posts_extra_tablenav )actionline 619 (+52 into the body)
Fires immediately following the closing "actions" div in the tablenav for the posts list table.
Uses · 9
- do_action()Calls the callback functions that have been added to an action hook.
- submit_button()Echoes a submit button, with provided text and appropriate class(es).
- __()Retrieves the translation of $text.
- current_user_can()Returns whether the current user has the specified capability.
- get_post_type_object()Retrieves a post type object by name.
- WP_Posts_List_Table::months_dropdown()
- WP_Posts_List_Table::categories_dropdown()Displays a categories drop-down for filtering on the Posts list table.
- WP_Posts_List_Table::formats_dropdown()Displays a formats drop-down for filtering items.
- WP_Posts_List_Table::has_items()
Source code
protected function extra_tablenav( $which ) { ?> <div class="alignleft actions"> <?php if ( 'top' === $which ) { ob_start(); $this->months_dropdown( $this->screen->post_type ); $this->categories_dropdown( $this->screen->post_type ); $this->formats_dropdown( $this->screen->post_type ); /** * Fires before the Filter button on the Posts and Pages list tables. * * The Filter button allows sorting by date and/or category on the * Posts list table, and sorting by date on the Pages list table. * * @since 2.1.0 * @since 4.4.0 The `$post_type` parameter was added. * @since 4.6.0 The `$which` parameter was added. * * @param string $post_type The post type slug. * @param string $which The location of the extra table nav markup: * 'top' or 'bottom' for WP_Posts_List_Table, * 'bar' for WP_Media_List_Table. */ do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); $output = ob_get_clean(); if ( ! empty( $output ) ) { echo $output; submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); } } if ( $this->is_trash && $this->has_items() && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) { submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); } ?> </div> <?php /** * Fires immediately following the closing "actions" div in the tablenav for the posts * list table. * * @since 4.4.0 * * @param string $which The location of the extra table nav markup: 'top' or 'bottom'. */ do_action( 'manage_posts_extra_tablenav', $which ); }Changelog
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 6.9.7 tag, from
src/wp-admin/includes/class-wp-posts-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.