WP_Terms_List_Table::handle_row_actions( WP_Term $item, string $column_name, string $primary ): string
- Since
- 4.3.0, 5.9.0
- Source
wp-admin/includes/class-wp-terms-list-table.php:467
Compatibility
- WordPress
- since 5.9.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
$itemWP_Term- Tag being acted upon.
$column_namestring- Current column name.
$primarystring- Primary column name.
Return value
string- Row actions output for terms, or an empty string if the current column is not the primary column.
Performance profile
How much work a call to WP_Terms_List_Table::handle_row_actions() 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
- Heavy
- Scaling
- Constant
- Instructions
- 6–185
- Plugin surface
- 3 hooks
- Called by
- 0
Reaches the database via get_term().
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 188.
Third-party callbacks on 'quick_edit_enabled_for_taxonomy', 'tag_row_actions', '{$taxonomy}_row_actions' 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
apply_filters()called directly - querycontent query
get_term()one call below WP_Terms_List_Table::handle_row_actions()
Further down the call graph this can also reach 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 · 25 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_Terms_List_Table::handle_row_actions() can have, taken from its control-flow graph on PHP 8.5.
| When | Instructions | Calls it makes |
|---|---|---|
$primary !== false | 6 | none |
$primary === false && !wp_doing_ajax() && !current_user_can() && !is_term_publicly_viewable() | 50 | wp_doing_ajax(), current_user_can(), current_user_can(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && !current_user_can() && !is_term_publicly_viewable() | 52 | wp_doing_ajax(), wp_get_referer(), current_user_can(), current_user_can(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && !current_user_can() && is_term_publicly_viewable() | 76 | wp_doing_ajax(), current_user_can(), current_user_can(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && !current_user_can() && is_term_publicly_viewable() | 78 | wp_doing_ajax(), wp_get_referer(), current_user_can(), current_user_can(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && !is_term_publicly_viewable() | 84 | wp_doing_ajax(), current_user_can(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && !is_term_publicly_viewable() | 86 | wp_doing_ajax(), wp_get_referer(), current_user_can(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && !is_term_publicly_viewable() | 102 | wp_doing_ajax(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), current_user_can(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && !is_term_publicly_viewable() | 104 | wp_doing_ajax(), wp_get_referer(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), current_user_can(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && is_term_publicly_viewable() | 110 | wp_doing_ajax(), current_user_can(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && is_term_publicly_viewable() | 112 | wp_doing_ajax(), wp_get_referer(), current_user_can(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && !is_term_publicly_viewable() | 123 | wp_doing_ajax(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), __(), sprintf(), esc_attr(), __(), current_user_can(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
13 further outcomes, up to 185 instructions
$primary === false && wp_doing_ajax() && !is_term_publicly_viewable() | 125 | wp_doing_ajax(), wp_get_referer(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), __(), sprintf(), esc_attr(), __(), current_user_can(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && is_term_publicly_viewable() | 128 | wp_doing_ajax(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), current_user_can(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && is_term_publicly_viewable() | 130 | wp_doing_ajax(), wp_get_referer(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), current_user_can(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && current_user_can() && !is_term_publicly_viewable() | 136 | wp_doing_ajax(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && current_user_can() && !is_term_publicly_viewable() | 138 | wp_doing_ajax(), wp_get_referer(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && is_term_publicly_viewable() | 149 | wp_doing_ajax(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), __(), sprintf(), esc_attr(), __(), current_user_can(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && is_term_publicly_viewable() | 151 | wp_doing_ajax(), wp_get_referer(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), __(), sprintf(), esc_attr(), __(), current_user_can(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && current_user_can() && !is_term_publicly_viewable() | 157 | wp_doing_ajax(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), __(), sprintf(), esc_attr(), __(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && current_user_can() && !is_term_publicly_viewable() | 159 | wp_doing_ajax(), wp_get_referer(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), __(), sprintf(), esc_attr(), __(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && current_user_can() && is_term_publicly_viewable() | 162 | wp_doing_ajax(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && current_user_can() && is_term_publicly_viewable() | 164 | wp_doing_ajax(), wp_get_referer(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && !wp_doing_ajax() && current_user_can() && is_term_publicly_viewable() | 183 | wp_doing_ajax(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), __(), sprintf(), esc_attr(), __(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
$primary === false && wp_doing_ajax() && current_user_can() && is_term_publicly_viewable() | 185 | wp_doing_ajax(), wp_get_referer(), current_user_can(), wp_unslash(), urlencode(), get_edit_term_link(), add_query_arg(), esc_url(), __(), sprintf(), esc_attr(), __(), apply_filters(), __(), sprintf(), esc_attr(), __(), current_user_can(), wp_nonce_url(), __(), sprintf(), esc_attr(), __(), is_term_publicly_viewable(), get_term_link(), __(), sprintf(), esc_attr(), __(), apply_filters(), apply_filters(), ->row_actions() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 187 | 6–184 | 6 | 1 fewer instruction than PHP 8.5 |
| 8.5 | 188 | 6–185 | 6 | |
| 8.4 | 188 | 6–185 | 6 | 3 more instructions than PHP 8.3 |
| 8.3 | 185 | 6–182 | 6 | |
| 8.2 | 185 | 6–182 | 6 | |
| 8.1 | 185 | 6–182 | 6 | 1 fewer instruction than PHP 7.4 |
| 7.4 | 186 | 6–182 | 6 |
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 · 3
3 hooks fire while WP_Terms_List_Table::handle_row_actions() runs, in this order:
- apply_filters( quick_edit_enabled_for_taxonomy )filterline 503 (+36 into the body)
Filters whether Quick Edit should be enabled for the given taxonomy.
- apply_filters( tag_row_actions )filterline 546 (+79 into the body)
Filters the action links displayed for each term in the Tags list table.
- apply_filters( {$taxonomy}_row_actions )filterline 564 (+97 into the body)
Filters the action links displayed for each term in the terms list table.
Uses · 14
- wp_doing_ajax()Determines whether the current request is a WordPress Ajax request.
- wp_get_referer()Retrieves referer from '_wp_http_referer' or HTTP referer.
- current_user_can()Returns whether the current user has the specified capability.
- esc_url()Checks and cleans a URL.
- add_query_arg()Retrieves a modified URL query string.
- wp_unslash()Removes slashes from a string or recursively removes slashes from strings within an array.
- get_edit_term_link()Retrieves the URL for editing a given term.
- esc_attr()Escaping for HTML attributes.
- __()Retrieves the translation of $text.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- is_term_publicly_viewable()Determines whether a term is publicly viewable.
Show all 14
- get_term_link()Generates a permalink for a taxonomy term archive.
- WP_Terms_List_Table::row_actions()
Source code
protected function handle_row_actions( $item, $column_name, $primary ) { if ( $primary !== $column_name ) { return ''; } // Restores the more descriptive, specific name for use within this method. $tag = $item; $taxonomy = $this->screen->taxonomy; $uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI']; $actions = array(); if ( current_user_can( 'edit_term', $tag->term_id ) ) { $actions['edit'] = sprintf( '<a href="%s" aria-label="%s">%s</a>', esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $uri ) ), get_edit_term_link( $tag, $taxonomy, $this->screen->post_type ) ) ), /* translators: %s: Taxonomy term name. */ esc_attr( sprintf( __( 'Edit “%s”' ), $tag->name ) ), __( 'Edit' ) ); /** * Filters whether Quick Edit should be enabled for the given taxonomy. * * @since 6.4.0 * * @param bool $enable Whether to enable the Quick Edit functionality. Default true. * @param string $taxonomy Taxonomy name. */ $quick_edit_enabled = apply_filters( 'quick_edit_enabled_for_taxonomy', true, $taxonomy ); if ( $quick_edit_enabled ) { $actions['inline hide-if-no-js'] = sprintf( '<button type="button" class="button-link editinline" aria-label="%s" aria-expanded="false">%s</button>', /* translators: %s: Taxonomy term name. */ esc_attr( sprintf( __( 'Quick edit “%s” inline' ), $tag->name ) ), __( 'Quick Edit' ) ); } } if ( current_user_can( 'delete_term', $tag->term_id ) ) { $actions['delete'] = sprintf( '<a href="%s" class="delete-tag aria-button-if-js" aria-label="%s">%s</a>', wp_nonce_url( "edit-tags.php?action=delete&taxonomy=$taxonomy&tag_ID=$tag->term_id", 'delete-tag_' . $tag->term_id ), /* translators: %s: Taxonomy term name. */ esc_attr( sprintf( __( 'Delete “%s”' ), $tag->name ) ), __( 'Delete' ) ); } if ( is_term_publicly_viewable( $tag ) ) { $actions['view'] = sprintf( '<a href="%s" aria-label="%s">%s</a>', get_term_link( $tag ), /* translators: %s: Taxonomy term name. */ esc_attr( sprintf( __( 'View “%s” archive' ), $tag->name ) ), __( 'View' ) ); } /** * Filters the action links displayed for each term in the Tags list table. * * @since 2.8.0 * @since 3.0.0 Deprecated in favor of {@see '{$taxonomy}_row_actions'} filter. * @since 5.4.2 Restored (un-deprecated). * * @param string[] $actions An array of action links to be displayed. Default * 'Edit', 'Quick Edit', 'Delete', and 'View'. * @param WP_Term $tag Term object. */ $actions = apply_filters( 'tag_row_actions', $actions, $tag );Changelog
Introduced in 4.3.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
$tag to $item to match parent class for PHP 8 named parameter support.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 6.7.7 tag, from
src/wp-admin/includes/class-wp-terms-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.