How Do I Redirect a WordPress Website?
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/.
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.
It seems this would just be a function of your theme. If you don’t provide links to single posts, categories, etc., then as far as your visitors are concerned, those things effectively don’t exist. If you really want to prevent access to things, you can’t redirect in a template as headers have already been sent. … Read more