Support » Plugins » Hacks » template_redirect keeps redirecting

  • Hi,

    I use template_redirect to redirect 404 requests to a custom template file (products.php):

    add_filter('template_redirect', 'mp_404_filter_override' );
    function mp_404_filter_override() {
        global $wp_query;
      status_header( 200 );
      include (TEMPLATEPATH . '/products.php');

    No problems redirecting the users. They all end up on products.php as they should.

    The problem is that products.php keeps reloading since the template_redirect filter I have set up is checked again and again.

    Any ideas on how I can stop products.php from reloading?


Viewing 1 replies (of 1 total)
  • Found a solution: Make sure products.php is a WP template and not just some random test HTML.

    The code above works perfectly (without reloading) if the products.php is a WP template.

Viewing 1 replies (of 1 total)
  • The topic ‘template_redirect keeps redirecting’ is closed to new replies.