You are here:  » If product no longer exists return 404


If product no longer exists return 404

Submitted by jamie on Fri, 2017-01-20 21:19 in

Hi David,

Upon updating my feeds, I am finding quite a few products that no longer exist.

Is it possible to send vistors to my wordpress's 404 error page and return a 404 response code instead of 200, if the product no longer exists?

Many thanks for your help,
Jamie

Submitted by support on Sat, 2017-01-21 10:32

Hello Jamie,

Sure - i'll include this in the forthcoming update. Edit pto.php and look for the following code at line 184:

      pto_product_query();

...and REPLACE with:

      pto_product_query();
      global $pto_productResults;
      global $wp_query;
      if (!count($pto_productResults))
      {
        $wp_query->set_404();
      }

Cheers,
David.
--
PriceTapestry.com