I'm using this script in WordPress, But every time it runs it leaves it's process running.
What can I do to end the process when it's done?
<?php
add_action('init', function(){
if(empty($_REQUEST['user_role_via_js']))
return; // Not applicable.
//$user = new WP_User((integer)$_REQUEST['user_role_via_js']); // Acquire user based on input ID.
$user = new WP_User(0, (string)$_REQUEST['user_role_via_js']); // Based on a username.
$role = reset($user->roles); // Get the role for this user.
header('Content-Type: application/json'); // Output JSON response.
exit(json_encode(compact('role')));
});