[Plugin: WP Super Cache] Redirect via wp_redirect() and custom field doesn’t work with super cache
-
Hi
since I am using WP Super Cache my redirect doesn’t work anymore.
I am using two custom fields for optional defining a redirect adress to which the page can be redirected automatically.
I have placed the following code in my themes page.php:// redirect via custom field global $post; // < -- globalize, just in case // redirect to any www adress if(get_post_meta($post->ID, 'redirect to www', true)) : $redirect_field1 = get_post_meta($post->ID, 'redirect to www:', true); wp_redirect(clean_url($redirect_field1), 301); // redirect to a specific ID elseif(get_post_meta($post->ID, 'redirect to id', true)) : $redirect_field2 = get_post_meta($post->ID, 'redirect to id:', true); wp_redirect(get_permalink($redirect_field2), 301); endif; // normaler WP Header get_header();
It seems that the redirect to www adresses still work but when I input an id for the redirect the page is loaded which should be actually redirected. When I turn off Super Cache everything works fine!
Any ideas?
I would like to know if there is a workaround für my page.php
oder maybe I can disable caching for specific pages by using a custom field input.
Viewing 8 replies - 1 through 8 (of 8 total)
Viewing 8 replies - 1 through 8 (of 8 total)
- The topic ‘[Plugin: WP Super Cache] Redirect via wp_redirect() and custom field doesn’t work with super cache’ is closed to new replies.