As for the user rows in the Users list table (at wp-admin/users.php), you would use the user_row_actions hook like so:
add_filter( 'user_row_actions', 'my_user_row_actions', 10, 2 );
function my_user_row_actions( $actions, $user_object ) {
// Remove the Edit action.
unset( $actions['edit'] );
// Add your custom action.
$actions['my_action'] = '<a href="<action URL>">Action</a>';
return $actions;
}
The other WordPress list tables which extend the WP_List_Table class also fire a similar hook with the same naming convention, i.e. <text>_row_actions, and here are the other available hooks list as of writing:
Note: These hooks mostly have only two parameters — $actions (an array of action links) and an object representing a post, term, user or comment — but the media_row_actions has a third parameter named $detached (see the docs for more details).
-
page_row_actions— fires in the Pages list table (pagepost type); second param:$post(aWP_Postinstance) -
post_row_actions— fires in the Posts list table (postand custom post types); second param:$post(aWP_Postinstance)Note that this hook and the one above, they are fired in the same list table class which is
WP_Posts_List_Table. -
media_row_actions— fires in the Media list table; second param:$post(aWP_Postinstance) -
comment_row_actions— fires in the Comments list table (which is also used in the Recent Comments dashboard widget); second param:$comment(aWP_Commentinstance) -
ms_user_row_actions— fires in the Network (or Multisite) Admin Users list table; second param:$user(aWP_Userinstance) -
<taxonomy>_row_actions— fires in the Terms list table ( for Tags (post_tag), Categories (category) and custom taxonomies ); second param:$tag(aWP_Terminstance) -
tag_row_actions— same as above, i.e. for any taxonomy — but if you want to target a specific taxonomy, you might want to use the above hook instead