Background of the issue:
I am trying to implement a live search module on my website, allowing users to get suggested search results in the correct language. The website's main language is French, and it is translated into English and Spanish. There are two types of posts on the website: default posts and a custom post type 'tutoriels' that uses a rewritten slug 'base-de-connaissance'.
The post-type is declared with the following parameter:
Symptoms:
On the English and Spanish versions of the website, visitors get a 404 error every time they try to access a tutorials-typed post from the live search results and from the search page, even though the URLs are correct.
Once you get the error, you get 404 every time you try accessing the base-de-connaissance and its related taxonomy archive pages.
Everything works as expected in the main version (French).
The problem doesn't occur when the live search module is deactivated, but it can be reproduced with several modules that do the same thing.
The problem doesn't occur if I remove the rewriting of the tutoriels custom post-type's slug.
Questions:
How can I fix the 404 error on translated custom post types when using the live search module?
Is there a way to maintain the rewritten slug without causing 404 errors on translated versions?
I just tried using Ajax Search Pro : the same issue occurs.
Weirdly enough, I can't seem to reproduce the problem in the Sandbox environment : I added the custom post-type, set up the rewritten slug translation with WPML and activated Relevanssi Live Ajax Search, and the search feature is working properly on the translated versions of the website.
I did notice something surprising : while testing things out, I changed the rewritten slug of the custom post-type to "retete, and then changed in back to "base-de-connaissance" in function.php, but in WPML > Settings > Post Types Translation, the slug is still registered as "retete", even after deleting WPML's cache.
Should I try importing the entire theme of my website ?
First, regarding the weird thing:
- I went to WPML > String translation.
- Searched for the string "retete" and deleted it
- Then I went to WPML > Theme and Plugins localization and rescanned the theme again
- After that, the slug of the post type is back to Baise de reconnaissance
- I translated it and everything kept working as expected.
So, it may be a compatibility issue with other components of your site.
About uploading your custom theme. You can do it and I am happy to take a look. But bear in mind that custom code is outside the scope of our support. I'll do my best to point you in the right direction but I may need to stop at some point 🙁
That said, before testing your theme in the sandbox environment I suggest you discard other compatibility issues on your end.
To do so:
❌ Please make a full website backup before proceeding ❌
Check if this issue appears in your test site when:
-Only WPML, its add-ons and Ajax Search Pro plugins are activated, as it will tell us if there is an interaction issue with another plugin
If you don't see the issue in the above scenario, activate one plugin at a time until you see the problem reappearing.
Let me know how this goes, please.
Best Regards,
Otto
The topic ‘[Closed] Error 404 when accessing a translated custom-typed post with a live search plugin’ is closed to new replies.