user_row_actions
Allows you to change the links (actions) displayed in a user's row in the Users list table in the admin panel.
Usage
add_filter( 'user_row_actions', 'wp_kama_user_row_actions_filter', 10, 2 );
/**
* Function for `user_row_actions` filter-hook.
*
* @param string[] $actions An array of action links to be displayed.
* @param WP_User $user_object WP_User object for the currently listed user.
*
* @return string[]
*/
function wp_kama_user_row_actions_filter( $actions, $user_object ){
// filter...
return $actions;
}
- $actions(string[])
- An array of links (actions) to display.
Default: 'Edit', 'Delete'. Or 'Edit', 'Remove' for Multisite - $user_object(WP_User)
- The current user object.
Examples
#1 Remove the password reset link from the Users table
is_admin() && add_filter( 'user_row_actions', 'wpkama_change_bulk_actions', 999 );
function wpkama_change_bulk_actions( $actions ){
unset( $actions['resetpassword'] );
return $actions;
}Changelog
| Since 2.8.0 | Introduced. |
Where the hook is called
user_row_actions
wp-admin/includes/class-wp-users-list-table.php 520
$actions = apply_filters( 'user_row_actions', $actions, $user_object );

