WP_MS_Users_List_Table::handle_row_actions( WP_User $item, string $column_name, string $primary ): string
- Since
- 4.3.0, 5.9.0
- Source
wp-admin/includes/class-wp-ms-users-list-table.php:535
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_User- User being acted upon.
$column_namestring- Current column name.
$primarystring- Primary column name.
Return value
string- Row actions output for users in Multisite, or an empty string if the current column is not the primary column.
Performance profile
How much work a call to WP_MS_Users_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
- Moderate
- Scaling
- Constant
- Instructions
- 6–106
- Plugin surface
- 1 hook
- Called by
- 1
Reads stored settings via get_site_option(), cached per request but not free on a cold cache.
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 107.
Third-party callbacks on 'ms_user_row_actions' run inside this call, and their cost is not bounded by anything here.
1 place 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 - optionnetwork option
get_site_option()one call below WP_MS_Users_List_Table::handle_row_actions()
Further down the call graph this can also reach query, 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 · 5 distinct outcomes
One number would be a lie: the work depends on which branch runs. These are every distinct cost WP_MS_Users_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 && !current_user_can() | 34–38 | get_super_admins(), current_user_can(), current_user_can(), apply_filters(), ->row_actions() |
$primary === false && current_user_can() | 66–70 | get_super_admins(), current_user_can(), wp_unslash(), urlencode(), get_edit_user_link(), add_query_arg(), esc_url(), __(), current_user_can(), apply_filters(), ->row_actions() |
$primary === false && !$super_admins | 74 | get_super_admins(), current_user_can(), current_user_can(), wp_unslash(), urlencode(), wp_nonce_url(), add_query_arg(), network_admin_url(), esc_url(), __(), apply_filters(), ->row_actions() |
$primary === false && current_user_can() && !$super_admins | 106 | get_super_admins(), current_user_can(), wp_unslash(), urlencode(), get_edit_user_link(), add_query_arg(), esc_url(), __(), current_user_can(), wp_unslash(), urlencode(), wp_nonce_url(), add_query_arg(), network_admin_url(), esc_url(), __(), apply_filters(), ->row_actions() |
Across PHP versions
| PHP | Compiled | Executed | Branches | Notes |
|---|---|---|---|---|
| 8.6-dev | 107 | 6–106 | 4 | |
| 8.5 | 107 | 6–106 | 4 | |
| 8.4 | 107 | 6–106 | 4 | 3 fewer instructions than PHP 8.3 |
| 8.3 | 110 | 6–109 | 4 | |
| 8.2 | 110 | 6–109 | 4 | |
| 8.1 | 110 | 6–109 | 4 | |
| 7.4 | 110 | 6–109 | 4 |
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 WP_MS_Users_List_Table::handle_row_actions() runs, in this order:
- apply_filters( ms_user_row_actions )filterline 563 (+28 into the body)
Filters the action links displayed under each user in the Network Admin Users list table.
Uses · 11
- get_super_admins()Retrieves a list of super admins.
- 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_user_link()Retrieves the edit user link.
- __()Retrieves the translation of $text.
- network_admin_url()Retrieves the URL to the admin area for the network.
- wp_nonce_url()Retrieves URL with nonce added to URL query.
- apply_filters()Calls the callback functions that have been added to a filter hook.
- WP_MS_Users_List_Table::row_actions()
Used by · 1
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. $user = $item; $super_admins = get_super_admins(); $actions = array(); if ( current_user_can( 'edit_user', $user->ID ) ) { $edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) ); $actions['edit'] = '<a href="' . $edit_link . '">' . __( 'Edit' ) . '</a>'; } if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins, true ) ) { $actions['delete'] = '<a href="' . esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; } /** * Filters the action links displayed under each user in the Network Admin Users list table. * * @since 3.2.0 * * @param string[] $actions An array of action links to be displayed. Default 'Edit', 'Delete'. * @param WP_User $user WP_User object. */ $actions = apply_filters( 'ms_user_row_actions', $actions, $user ); return $this->row_actions( $actions ); }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.
$user to $item to match parent class for PHP 8 named parameter support.from the docblockAbout this page
- Parsed data
- Generated from the wordpress-develop 7.0.4 tag, from
src/wp-admin/includes/class-wp-ms-users-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.