L
L
leviathan2017-09-10 18:21:50
css
leviathan, 2017-09-10 18:21:50

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

2 answer(s)
F
finchmgn, 2019-05-24
@finchmgn

Use the mix-blend-mode CSS property

M
Maxim Kudryavtsev, 2017-09-10
@The_Lars

=== 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 question

Ask a Question

731 491 924 answers to any question