How to fix Ahref error showing wordpress admin pages as “Duplicate pages without canonical”?
How to fix Ahref error showing wordpress admin pages as “Duplicate pages without canonical”?
How to fix Ahref error showing wordpress admin pages as “Duplicate pages without canonical”?
Why is the session clearing after wp_safe_redirect?
You need to separate the redirect function from the setcookie function For setcookie function use add_action(‘wp’, ‘your_cookies_function_name’,10,1) Note that it’s recommended to use wp and not init because is_page will not work with init And for the redirect function: function your_redirect_function_name() { if(is_page(‘uae’) && $_COOKIE_[‘region’] !== “UAE”){ wp_redirect(‘http://domain.com/uae/’); exit(); } } add_action( ‘template_redirect’, ‘your_redirect_function_name’,9 ); … Read more
Why does it need to be a Shortcode? Looks like a XY Problem. You’re already inserting the shortcode manually in the edit screen. Use a Custom Field instead and hook earlier where you can actually do the redirect. add_action( ‘template_redirect’, function(){ global $post; $redirect = get_post_meta( $post->ID, ‘redirect’, true ); if( $redirect ) { wp_redirect( … Read more
Hope this links will help you, link OR This is the function that you need: add_action( ‘profile_update’, ‘custom_profile_redirect’, 12 ); function custom_profile_redirect() { wp_redirect( trailingslashit( home_url() ) ); exit; } You can also set it for a specific User Role: add_action( ‘profile_update’, ‘custom_profile_redirect’, 12 ); function custom_profile_redirect() { if ( current_user_can( ‘subscriber’ ) ) { … Read more
I have solved the issue by myself. I am posting the solution here in case if someone gets the same problem. function wpse15677455_redirect() { $ref = wp_get_referer(); if (is_page(1911) && $ref !== “https://www.example.com/contact”){ wp_redirect( get_home_url() ); } else if(is_page(1269) && $ref !== “https://www.example.com/contact-form-2”){ wp_redirect( get_home_url() ); } else if(is_page(1825) && $ref !== “https://www.example.com/contact-form-3”){ wp_redirect( get_home_url() … Read more
wp_redirect send a header, so echoing anything before it will make the redirect fail. So, in this case you could remove echo network_home_url( ‘/receptionist’ ); and if there isnt any output being sent it will work just fine. Update: In both cases the issue is that you do an infinite redirect (redirect to that url … Read more
When you call wp_redirect it sends redirect HTTP headers, and that’s all the browser needs to redirect, there is no reason to continue executing code. So you must exit. wp_redirect will not do it for you, and PHP won’t do it for you if you send the http header to redirect. If you do not … Read more
Your code is completely flawed – not to mention you can’t redirect to the HTTP referer after login… because the referer is now the login page. Instead, use the login_redirect filter: add_filter( ‘login_redirect’, function ( $redirect_to, $requested_redirect_to ) { if ( ! $requested_redirect_to ) { $redirect_to = wp_get_referer(); } return $redirect_to; }, 10, 2 ); … Read more
wp-admin Redirects to Docker Container Name