Tag Info

New answers tagged

0

Considering WordPress Codex, and WordPress Template Hierarchy - attachments stores as post records. Your code is making a loop redirection to the same page. The most reasonable case is: Your $post->post_parent equal to 0. If you'll make a var_dump(get_permalink($post->post_parent));, youll notice that the output would be the same page url.


0

So the problem was redirect_guess_404_permalink was detecting a 404 error and 'guessed' /members/blog to be /blog My hacky solution was to hook into the status error check (Stop Wordpress from "guessing" redirects for nonexistent URLs) and if URL parts match then unset the guessed solution function blog_no_redirect_guess_404_permalink( $header ){ ...


0

That is because page_template action really works only for "Pages". Not for blog listing / home ... You can use template_include hook with broader impact.


0

You could approach the problem from the other side and look up the post based on the HTTP_REFERER, available in the $_SERVER superglobal: http://php.net/manual/en/reserved.variables.server.php You could perform a lookup of the page based on the URL of $_SERVER['HTTP_REFERER'] and get post information that way. You can also keep your 301s cleaner by not ...



Top 50 recent answers are included