[Resolved] Setting 404 on pages with no translations
This thread is resolved. Here is a description of the problem and solution.
Problem: The client wants to configure WPML so that if a page does not exist in a specific language, accessing the URL for that language version returns a 404 error, instead of redirecting to the original language or displaying the content in the default language.
Solution: 1. We identified that the issue occurs only when the client's Child Theme is active. 2. To resolve the issue, we suggested commenting out lines 3 to 13 in the functions.php file of the Child Theme. 3. We explained that WPML's default behavior is to redirect to the original content if a translation does not exist, which is generally beneficial for SEO. 4. We mentioned that disabling this behavior would require custom code using hooks such as
wpml_is_redirected
and
template_redirect
. 5. We provided links to the relevant documentation:
6. We informed the client that this customization goes beyond WPML's integrated functionality and our support policy, which can be found here: https://wpml.org/purchase/support-policy/. 7. For further assistance, we recommended seeking help from an experienced developer and provided a link to find contractors: https://wpml.org/contractors/.
If this solution does not seem relevant to your situation, please open a new support ticket at our 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.
I have a translation plugin installed on the website called WPML.
I have development domains: hidden link hidden link
I would like to know how to disable the default language when the translation for a particular page does not exist in that language.
For example, we have a page: hidden link that does not exist in English, yet it appears under the domain hidden link, even though it is only created in German.
This is evident when I click "Edit Page" for the English version -> hidden link because it redirects me to the editing page in German -> hidden link
I would like to configure it so that if a page does not exist in a specific language, accessing such a link returns a 404 error.
So, for example, if someone tries to access the URL hidden link, they should receive a 404 error. It should only work for the link hidden link.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Hallo Jakub,
Kann es sein, dass Du unter WPML > Einstellungen > Beitragstypen übersetzen eingestellt hast, das für Seiten, die nicht übersetzt sind, der originalen Inhalt angezeigt werden soll?
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
Hello,
Sure, I would like to offer to have a closer look at the problem and request temporary access (wp-admin and FTP) to the website to investigate this issue further.
You can find the required fields below the comment section when you log in to leave the next reply. The information you provide is private, which means only you and I can see and access it.
IMPORTANT
Please be sure to make a backup copy of the website and database before allowing us access.
If you can't see the wp-admin / FTP fields, your post and website credentials are set as PUBLIC. DO NOT publish the data unless you see the required wp-admin / FTP fields.
The private response form looks like this: hidden link
Next time you reply, click "I still need assistance."
Video: hidden link
Please note that we are obliged to request this information individually on each ticket. We may not access any access information not specifically submitted on this ticket in the private response form.
Languages: English (English )Spanish (Español )German (Deutsch )
Timezone: America/Lima (GMT-05:00)
It is the WPML default behavior, as it will always redirect to the original content if a translation does not exist. This includes, that we do not have any entry yet for this untranslated content in our language tables, and this is why we force to redirect to the original content.
This behavior makes sense, as it might be better for your SEO rating and there is usually no way, that based on the site's navigation and WPML's internal linking feature someone would even land on content, that never was translated unless they manually enter the URL inside the address bar of the browser.
The only exception would be if the user uses custom menu items or custom links that point to untranslated content.
I tried to test this, but could not come up with a working solution for your use case yet and can sadly not spare more time for running further tests at the moment.
Please take note, that this request goes beyond the integrated functionality of WPML and such a request is not covered by our support policy: https://wpml.org/purchase/support-policy/
You can find contractors on the following link, in case you need assistance from an experienced developer: https://wpml.org/contractors/