This topic has 5 replies, 2 voices, and was last updated 6 years, 11 months ago ago by Olga Barlow
Hello,
For as long as I can remember, the brand pages stop working intermittently giving a 404 error message. I resave permalinks, it works for a few days, I leave it alone. Few days later I see massive spike of 404 error pages on google webmaster, I come back to check if the brand pages are working and again it’s gone back to 404 error pages.
I resave the permalinks, it works for a few days and I come back few days later and it’s gone back to 404 error again.
This is happening without me even touching the website. How do I stop it constantly reverting back to 404’s. I shouldn’t have to be constantly resaving permalinks to get it working for a few days.
Hello,
When you re-save permalinks WP makes changes in .htaccess file. If you get the errors check the code that you have in that file when you see the error and then re-save permalinks and check the file again and code that you have there. Compare them. Are there any changes?
Also, tell me what version of XStore theme and XStore Core plugin do you use?
Regards
It has happened again. I am using Nginx so it has no such thing as a htaccess file. The hosting company have identified it is happening from the theme because the rewrite_rules in wp_options are being broken by theme overwriting the value. The theme is overwriting it with a 404 re-write rules.
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
Hello,
We use the default parameter for the brands permalinks in /et-core-plugin/inc/post-types.php
https://prnt.sc/hpgv9z
It’s not possible to save changes for the brand permalinks without this parameter, that’s why we use it. You may try to change it to 'rewrite' => false,
re-save permalinks after that and check if it helps in your case.
Regards
Tagged: 404 error, best selling, permalinks, themes, woocommerce
You must be logged in to reply to this topic.Log in/Sign up