Background of the issue:
In my website, there is a custom post type called school. French is the default language and English is the secondary language. I have set up school post type to - Translatable (use translation if available or fallback to default language). The URL for the single school page is hidden link (English version) and it is working properly.
Symptoms:
If I visit the page as hidden link (French version), it results in a 404 error.
Questions:
How can I fix the 404 error for the French version of the single school page?
Should I use rewrite rules or is there any other solution?
I understand the issue you're facing. This type of problem typically arises from a conflict with slugs. Specifically, if the same slug is used multiple times across post types, taxonomies, posts, or pages, you may encounter a 404 error when trying to access the item with that slug. Could you please check and make sure that the slug used for the "School" post type has not been used anywhere else?
If not, please add the WPML Debug Information in the next message so that I can get a better overview of the site and system.
Thank you for providing the debug information. I revisited your site and noticed that particular post is accessible via this link: hidden link
It appears that the slug "creche" is not assigned to any post type, which is why you're encountering a 404 error.
To include this slug in the URL, you'll need to adjust the CPT configuration and add the slug for the default language. For other languages, I'd recommend translating the post type slug following the steps outlined in this link.
I hope you can understand. Feel free to let me know if you need further assistance in this matter. I will be happy to help.
Yes, I got it. But unfortunately we can't do that. Because we have already used slug - school everywhere. If we change it to ecole, it will cause lots of errors throughout the website, even in JavaScript.
So, Is there any other approach that we can try? Please let me know if it is.
Hello There,
I hope you're doing well. Sorry for the delay in responding due to the weekend.
Thank you for the update. If I use the 'school' slug in French instead of 'creche', there is no problem accessing the post. The post loaded without the 404 error.
If you want to use a different slug for the French version, as I mentioned previously, you'll need to edit the CPT configuration and adjust the slug according to your needs. For example, if you want to have "crèche" in the French language, edit the CPT configuration and add that slug instead of "school". For English and other languages, you can translate the slug by following the instructions mentioned in this guide.
The method I described is the standard approach for defining slugs for the default language and translating them. Unfortunately, beyond that, there is no other approach to translate slug.
However, if you could share more details about your objective and what you're specifically trying to achieve, I can explore other possible solutions and do my best to assist you.
Looking forward to your response and I'm always here to help.
Best regards,
Prosenjit
The topic ‘[Closed] I’m facing a redirection issue in single post pages’ is closed to new replies.