Use wp-admin/admin.php
with an action
parameter:
<a href="https://wordpress.stackexchange.com/questions/184153/<?php echo esc_url( admin_url("admin.php?action=wpse_184153_create_page&user_id=$user_id" ) ) ?>">Create Page</a>
And then hook onto the event:
function wpse_184153_create_page() {
$redirect = admin_url( 'users.php' );
if ( ! empty( $_GET['user_id'] ) && $user = get_userdata( ( int ) $_GET['user_id'] ) ) {
// Create your page
// Add any URL parameters you need for the return page
$redirect = add_query_arg( 'created_page', $user->ID, $redirect );
}
// Send 'em back to users.php
wp_redirect( $redirect );
exit;
}
add_action( 'admin_action_wpse_184153_create_page', 'wpse_184153_create_page' );
You can name the function anything you want – the key thing to notice is how the hook matches the value of your action
parameter, with the suffix admin_action_
.