Adding custom column in User List with custom action

I want to add a custom column in the User list in the WordPress admin dashboard with a custom action to perform. It means in the custom column, I want to add a button for each user. While clicking the button, it will redirect to a new page link with user_id. How can I achieve this?

Topic list-authors Wordpress

Category Web


Start up a new custom plugin for something like this, and add the first code below to add a custom “Actions” column, and the second function will add some link to the column for each row.

add_filter( 'manage_users_columns', 'new_column_user_table' );
function new_column_user_table( $column )     {
    $column['actions'] = 'Actions';
    return $column;
}

add_filter( 'manage_users_custom_column', 'new_column_user_table_row', 10, 3 );
function new_column_user_table_row( $val, $column_name, $user_id ) {
    if($column_name == 'actions') {
        return “not sure what link you want, but your link code goes here”;
    }
    return $val;
}

Refs:

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.