Overiding wp_sanitize_redirect for | character
There was another solution. I looked here: https://www.w3schools.com/tags/ref_urlencode.asp And it stated the encoded value for a | character was %7C so I was able to use that in my redirection URLs.
There was another solution. I looked here: https://www.w3schools.com/tags/ref_urlencode.asp And it stated the encoded value for a | character was %7C so I was able to use that in my redirection URLs.
If you have a WordPress site at the location of the subdomain, you can simply create a redirect with this plugin: https://wordpress.org/plugins/redirection/.
You can use a plugin to redirect all URLs to any other URL. https://en-ca.wordpress.org/plugins/redirection/
get_user_id() is not a function so you’ll get an error for that. Additionally, you can get the author id by calling the $post global and accessing the property post_author add_action( ‘template_redirect’, ‘redirect_non_permitted_users’ ); function redirect_non_permitted_users () { if (is_admin()) return; $userID = get_current_user_id(); global $post; $authorID = absint($post->post_author); if( $userID !== $authorID && ! is_user_logged_in() … Read more
It sounds like a caching issue as mobile is the same domain. Try a different browser or if you use Chrome. Open Inspection Tool > Network Tab > then check Disable Cache Then do a hard refresh. If you aren’t sure how. Click and hold on the refresh icon with the inspection tool open.
As the docs say: Note: wp_redirect() does not exit automatically, and should almost always be followed by a call to exit;: wp_redirect( $url ); exit;
Why sometimes wp_redirect() reset cookie?
Infinite redirect loop in my local environment
How do you maintain a debug session after wp_redirect()?
I am not sure if you just simplified for example, but make sure you use full URL in wp_redirect() call. Also rather than having it in template, I think it would be more appropriate to run this at template_redirect hook.