add_action('rest_api_init', function () { register_rest_route('custom/v1', '/is-logged-in', array( 'methods' => 'GET', 'callback' => function () { return is_user_logged_in() ? array('status' => 'logged_in') : array('status' => 'not_logged_in'); }, 'permission_callback' => '__return_true', )); }); // Allow CORS for the REST API add_action('rest_api_init', function () { header('Access-Control-Allow-Origin: https://ai.rolmodelim.com'); // Allow only your subdomain header('Access-Control-Allow-Credentials: true'); });