Conditional Content Linked to Cookie Value Only Shows on 2nd Page Load

Since you are relying on the URL parameter to set cookies, why not prioritize it over the cookie for the first page load? At your second code block, changing the line $plan_cookie to this might help. $plan_cookie = isset($_GET[‘plan’]) && !empty($_GET[‘plan’]) ? $_GET[‘plan’] : (isset($_COOKIE[‘plan’]) ? sanitize_text_field($_COOKIE[‘plan’]) : ”);

How can I access user information on a subdomain?

Found two solutions: 1) global $current_user; $wp_get_current_user_id = $current_user->ID; $wp_get_current_user_id = apply_filters( ‘determine_current_user’, false ); Which then in helloworld.php would be return: echo json_encode( array(‘wordpress_user_id’ => wp_get_current_user_id) );

How do I modify each instance of setcookie?

I installed the SameSite plug-in which mimics the default PHP setcookie behavior and adds the additional parameter (samesite) to the cookie. I set the plug-in configuration in wp-config.php with: define( ‘WP_SAMESITE_COOKIE’, ‘None’ ); By setting the configuration of samesite=None, browsers will not enforce SameSite rules that are used to prevent CSRF. From the Mozilla blog: … Read more