Reply 180267 to: Saving permalinks does not fix brand page 404 error

Avatar: denvysb
denvysb
Participant
December 16, 2017 at 11:41

Right ok I have found why it is producing the 404 error but not where the code lives in your theme that is causing it.

404 versions is running this code:
SELECT wp_posts.*
FROM wp_posts
WHERE 1=1
AND wp_posts.post_name = ‘test’
AND wp_posts.post_type = ‘product’
ORDER BY wp_posts.post_date DESC
Which of course does not exist

where as the working version is running this code:
SELECT t.*, tt.*
FROM wp_terms AS t
INNER JOIN wp_term_taxonomy AS tt
ON t.term_id = tt.term_id
WHERE tt.taxonomy IN (‘brand’)
AND t.slug = ‘test’
LIMIT 1

Which one to run use is being decided by this piece of code:
WP_Query->get_posts()
wp-includes/class-wp-query.php:2831

Go To The Whole Conversation In Topic
We're using our own and third-party cookies to improve your experience and our website. Keep on browsing to accept our cookie policy.