Skip to content Skip to sidebar

This thread is resolved. Here is a description of the problem and solution.

Problem:
If you're experiencing a 404 error on your WooCommerce category page due to a compatibility issue with Rank Math, it might be related to the 'Remove parent slugs' option or incorrect slug translations for different languages.
Solution:
1. Check if the 'Remove parent slugs' option in Rank Math is causing the issue. A temporary fix can be found in our errata: https://wpml.org/errata/rank-math-seo-remove-parent-slugs-option-causes-category-slug-translation-error-404/
2. If the issue persists, you may need to adjust the slug translations:
- Navigate to WPML > Settings > Slug translations and ensure it is enabled.
- Go to WPML > Taxonomy Translation > Product Categories and check the slug translations for each language.
- Ensure that the slug translations are either blank or a copy of the original WordPress settings: 'product-category'.
3. If you have modified the Rank Math plugin files as a workaround, ensure to update the slug translations accordingly. You might need to edit the original pages and update the translations in the Advanced Translation Editor.

This solution might be outdated or not applicable to your specific case. We highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If the problem persists, please open a new support ticket at WPML support forum.

This is the technical support forum for WPML - the multilingual WordPress plugin.

Everyone can read, but only WPML clients can post here. WPML team is replying on the forum 6 days per week, 22 hours per day.

Tagged: 

This topic contains 5 replies, has 1 voice.

Last updated by bikbulatovaE 1 week, 4 days ago.

Assisted by: Andreas W..

Author Posts
August 24, 2025 at 9:46 pm #17343560

bikbulatovaE

Background of the issue:
I am trying to resolve a 404 error that appears in the search console when accessing a WooCommerce category page. The issue seems to be related to a compatibility error with Rank Math. The problem can be seen on this page: hidden link

Symptoms:
I expected to see the page, but instead, I got a 404 error.

Questions:
How can I fix the 404 error on my WooCommerce category page?
Is there a known compatibility issue between WPML and Rank Math that could cause this error?

August 24, 2025 at 9:49 pm #17343576

bikbulatovaE

Hello, just to recap: Wrong landing page for translated product category.

- Temporary fix 1: Error is due to the "Remove parent slugs" option enabled in the Rank Math SEO parameters. Fix available here https://wpml.org/errata/rank-math-seo-remove-parent-slugs-option-causes-category-slug-translation-error-404/
- Temporary fix 2: Disabling rank math and enabling it back also resolves temporary the issue.

Recurring problem!!!! Please find a solid fix to prevent its occurrence. It kills my SEO.
THANKS

August 24, 2025 at 10:15 pm #17343577

bikbulatovaE

Adding some precisions. Screenshot 1, configuration is problematic. Screenshot 2, it works well.
However, I do need configuration 1 for analytics purpose (/product-category/ and /product/ in the urls). The configuration 2 was done a long time ago on another website and I don't want to create a mess with seo.

image.png
image (1).png
August 25, 2025 at 5:33 pm #17345915

Lauren
WPML Supporter since 10/2015

Languages: English (English )

Timezone: America/New_York (GMT-04:00)

Thank you for contacting WPML support. While you are waiting for one of my colleagues to take this ticket and work on it, let me provide you with first debugging steps or if I can perhaps help with the issue quickly. As you noted, this is a known issue that our developers are currently working to resolve. Did you apply the workaround from the errata? https://wpml.org/errata/rank-math-seo-remove-parent-slugs-option-causes-category-slug-translation-error-404/

This workaround is coming from a change in the Rank Math file, so their author will need to implement the change in an upcoming release In order for the fix to be permanent. We work closely with Rank Math so I'm fairly certain it will be included in a near future update. In the meantime, adjusting that code should resolve the issue. Please let us know if it does not and we can look further into this.

August 27, 2025 at 7:02 am #17350192

bikbulatovaE

I found the issue. It is a bug related to "Slug translations".
I disabled this option because obviously I don't need it. However, when testing stuff on the staging website, I found out that some languages still have this slug translation.

Recap:
1/ Turn on "Slug translations" : WPML - Settings - Slug translations
2/ Check the slugs: WPML - Taxonomy Translation - Product Categories
3/ Result:
- Some languages already had their product category slug translated. These languages are all problematic (404 error when trying to open any product category).
- Other languages didn't have any slug translations (French, German). And they work just fine.
4/ The fix:
- Either the slug translation should be blank.
- Either the slug translation should be a copy of the original wordpress settings: product-category.
- Please advice, how to delete the slug translation for all taxonomies when disabling the function "Slug translations". This was my issue. For some reason, I had translations saved with the slug translation option disabled. Maybe I tested the function before and figured out it's useless in my case.

However, disabling the function should also delete the translated slugs. So this is your plugin improvement job.

I will just copy the original slug for the moment, for all languages. Since it works well. And I don't know how to delete this type of translations.

Capture d’écran 2025-08-27 110139.jpg
Capture d’écran 2025-08-27 110200.jpg
August 30, 2025 at 8:02 pm #17359933

Andreas W.
WPML Supporter since 12/2018

Languages: English (English ) Spanish (Español ) German (Deutsch )

Timezone: America/Lima (GMT-05:00)

Hello,

Sadly, disabling the option alone will not adapt the slug for all your translations.

You will need to update the translations in this case.

Further slug translations must be saved already inside the translation memory of the Advanced Translation Editor, which means that you will neeed to edit the titles of the original pages, then save the pages, and then update the translations.

About the RankMath SEO issue:

If you apply the workaround of this errata to the Rankmat plugin, it will temporarily solve the issue. The issue needs to be solved on the side of RankMath. Feel free to report it again to them as a reminder.

Open …/wp-content/plugins/seo-by-rank-math/includes/modules/woocommerce/class-permalink-watcher.php file.

Look for line 124.

Replace this code:

$permalink_structure  = wc_get_permalink_structure();
$category_base        = trailingslashit( $permalink_structure['category_rewrite_slug'] );
$is_language_switcher = ( class_exists( 'Sitepress' ) && strpos( $link, 'lang=' ) );

With:

$permalink_structure  = wc_get_permalink_structure();
 
// WPML Workaround for compsupp-6895
if ( class_exists('Sitepress') ) {
    $args = array('element_id' => $term->term_id, 'element_type' => $taxonomy );
    $term_language_info = apply_filters( 'wpml_element_language_details', null, $args );
    $permalink_structure['category_rewrite_slug'] = apply_filters('wpml_translate_single_string', $permalink_structure['category_rewrite_slug'], 'WordPress', 'URL '.$taxonomy.' tax slug', $term_language_info->language_code );
}
 
$category_base        = trailingslashit( $permalink_structure['category_rewrite_slug'] );
$is_language_switcher = ( class_exists( 'Sitepress' ) && strpos( $link, 'lang=' ) );

Make sure to take a backup of your site before making the changes.

Best regards
Andreas

August 31, 2025 at 7:55 am #17360089

bikbulatovaE

I don't understand what you're talking about.

The problem is related to the translated taxonomy slugs, which are different from the standard WooCommerce ones:
- /product-category/
- /product-tag/

They should be identical to the default (English) ones and not translated.
You could improve the taxonomy slug translation option by removing the data entered when disabling the option. This was precisely my problem.

I didn't see the error until I re-enabled the slug translation option and viewed the translations on the Taxonomy > Product Category page. The two working languages, French and German, had no slug translations. All other languages ​​were buggy and had translations in Italian, Dutch, Spanish, etc.
After copying the default English slug to the other languages, everything worked.