qtranslate / qtranslate-xt

qTranslate-XT (eXTended) - reviving qTranslate-X multilingual plugin for WordPress. A new community-driven plugin soon. Built-in modules for WooCommerce, ACF, slugs and others.
GNU General Public License v2.0
545 stars 103 forks source link

[Slug translation module] When category base is removed, it gives category 404 in other languages. #1362

Open ersinco opened 11 months ago

ersinco commented 11 months ago

Create a post category. Category name: test category Category url: /test-category

Site's Category Base Slug: /category

Category url: example.com/category/test-category

But when I remove the category base with the plugin or remove it from functions.php with code, the categories look like this.

example.com/test-category

This is exactly what I want, but when we translate the test category in a different language, say french.

English Category Slug: example.com/test-category

French Category Slug example.com/test-category-fr

When I change the site language to french, I can't get to the category.

When I restore the category base, the access to the category opens.

Initially, this is how the category works.

example.com/category/test-category-fr

I don't want to use the /category/ slug, at the url of the categories.

Expected behavior -------------

example.com/test-category-fr

Smooth working of URL translation.

Versions : 3.15.2



**Additional context**

Slug module works really problematic.

If you don't want to use the /category prefix, you cannot access the category in other languages.

I removed the category base with a few different methods, some of them are working fine, but this time you cannot access any article on the site, it gives 404 articles.
spleen1981 commented 11 months ago

How do you exactly remove the category base slug from functions.php? Sounds like an hack, no surprise if does not work out of the box.

ersinco commented 11 months ago

How do you exactly remove the category base slug from functions.php? Sounds like an hack, no surprise if does not work out of the box.

wordpress.org/plugins/no-category-base-wpml/

Actually I use this plugin in all my projects. I haven't had any problems so far.

You can reference this plugin.

Even if I change it with functions.php, the result remains the same.

Can you tell me a way to remove the /category slug?

spleen1981 commented 11 months ago

The plugin is mentioning expressly WPML in the title, so it looks like it is not compatible with QTX. Maybe you may propose to extend this functionality to QTX on their side.

Apart from the plugin above, possible customization in functions.php should comply with QTX code, not vice versa, though pull requests within the scope of the plugin are generally welcome.

Personally I haven't had the need for this customization so far, so I don't have any ready to go suggestion...