• Resolved gerske

    (@gerske)


    The product pages in the default (for our site it is Dutch) language gave 404 errors. In WordPress I have permalinks default choice, also for Woocommerce slug. So, it is /product/…

    Somehow, Translatepress changed the default language “product” slug to “produkt” (with a k). Visitors going to domain.nl/product/… saw a 404 error. Also all other languages gave 404 errors.

    I “fixed” this by saving the permalinks again (without changing anything) and clear the cache. This made it work again in Dutch language, and several other languages, but not all. I went to the slug translater and changed the slug translation of “product” for those languages. Now it seems working again, but after a while Translatepress again breaks it. Translatepress is messing with the translation of “product”, making 404 errors.

    Is there a way that Translatepress NEVER translates the word “product” in the URL again? I have tried by adding “product” in the string that should not be translated, but Translatepress still keeps doing it. ;-(

    So, for the French version it switches over time from product to produit, and one of these give a 404 error.

    Or as an alternative: Can we get rid of “product” in the URL? So it would be domain.nl/xyz instead of domain.nl/product/xyz. That way the bug in the plugin cannot ruin the slug by renaming product without asking. In RankMath there is an option to get rid of “product”, but by switching that on, none of the translated product pages work.

    Please help me with this really annoying problem, which is costing us a lot of money and giving us frustrated customers!

    Kind regards,
    Gerske

    • This topic was modified 2 years, 2 months ago by gerske.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter gerske

    (@gerske)

    What I already tried is to use “product” for each language. So also French, German, etc. For that I used the strings translate option of Translatepress for the Woocommerce slug “product/”. After saving “product” for each language, it works fine. But after a while (for example) the French version is CHANGING without asking the URL to “produit” nevertheless. And giving 404 errors. After checking again the strings translate fields for the product Woocommerce slug are emptied for some reason. Not by me!

    There definately is a bug in Translatepress for this.

    However, it seems to have stopped after I have added this snippet of code:

    /*
    Plugin Name: TranslatePress – No translation for product base slug
    Plugin URI: https://translatepress.com/
    Description: Disable translating the product base slug in WooCommerce for secondary languages.
    Version: 1.0.
    Author: Cozmoslabs, Cristian Antohe
    Author URI: https://cozmoslabs.com/
    License: GPL2
    */

    add_action( ‘trp_before_running_hooks’, ‘trpc_remove_hooks_to_disable_product_base_slug_translation’, 10, 1);
    function trpc_remove_hooks_to_disable_product_base_slug_translation( $trp_loader ){
    $trp_loader->remove_hook( ‘option_rewrite_rules’, ‘woocommerce_filter_permalinks_on_other_languages’ );
    $trp_loader->remove_hook( ‘option_woocommerce_permalinks’, ‘woocommerce_filter_permalink_option’ );
    }

    Now, each language keeps the “product” in the URL, and it no longer seems to get translated and corrupt by Translatepress. So, I’m very glad with this code for now.

    I wish however, Translatepress would be able to fix the problem, so I don’t need to have extra code.

    So, people having the same problem as I do, by adding the code above (via Code Snippets for example), you can prevent the problem from happening.

    Dragos

    (@dragosvrejiu)

    Hello,

    Thank you for your feedback!

    We are looking into the issue and will come up with a resolution.

    However, I can not provide any ETA’s for the time being.

    Best wishes,

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘“product” in slug is changing and giving 404 errors’ is closed to new replies.