Answer the question
In order to leave comments, you need to log in
Woocommerce pages conflict with categories?
In short, there are categories that are named the same as some of the pages. For example: /napitki/ and a page with the same name /napitki/, but if you go to this page, you get to the category page...
At first it didn’t happen, it all started after the transfer (I pressed something and everything broke). It's over, you can just rename the categories, but I'm wondering - why did everything break then?
Answer the question
In order to leave comments, you need to log in
=== VANGA MODE ON ===
You need to get familiar with how the Rewrite API works in Wordpress. Very briefly, there is a list of 16 basic rules: categories (/category/), tags (/tags/), pages, posts, and navigation/pagination, i.e. numbers at the bottom of category/tag pages (/page/1/ or /page/2, etc.).
Of course, WP allows the developer to add a new rule himself if he needs it. The new rule can be added either at the beginning (recommended) or at the end of the standard list of rules. To add a new rule, the add_rewrite_rule
function is most often used , however, if you start digging into old plugins, you will see that, along with this, a new rule can also be added on the filtergenerate_rewrite_rules .
Both of these methods lead to the same result, you can read about the differences on the network, somewhere on StackOverflow there was a rather competent description.
As far as I remember, Woocommerce adds its rules via the add_rewrite_rule function to the top of the list of rules, so if you have two pages with the same URL (a product in Woocommerce and a category/page/tag), then Wordpress will send you to the first one that comes across. Previously, apparently, you had a Woocommerce product first, then a category.
Where do you think WP stores the rules? I don’t know any options other than the wp_option table in the database. When transferring your database between servers, it is possible that something was optimized there during export / import, and now your Woocommerce rule has fallen down, i.e. began to go after the standard Wordpress rules. For this reason, you observe this behavior.
=== VANGA MODE OFF
If options 1 and 2 do not work out, install the Query Monitor plugin and start debugging
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question