Skip Navigation

This thread is resolved. Here is a description of the problem and solution.

Problem:
The client has a WordPress site with Dutch as the default language and English as a secondary language. They want to display the Dutch menu on English pages or add Dutch pages to the English menu in Appearance -> Menus. However, when switching to English, the system seeks the translation of the menu, and the client struggles with adding Dutch pages to the English menu.

Solution:
We recommend setting your pages and posts to "Translatable - use translation if available or fallback to default language". Here are the steps to achieve this:
1. Go to WPML -> Settings and set pages and posts to "Translatable - use translation if available or fallback to default language".
2. Navigate to Appearance -> Menus, switch to the translated menu, and delete it.
3. Ensure that the default language menu is assigned as the main menu.
4. Check the front end to see if it displays correctly in the translations.
If this does not resolve the issue, consider duplicating the pages in bulk. You can do this by going to WPML -> Translation Management, selecting the pages you need, and clicking on "Duplicate".

Additionally, avoid altering database entries directly as it can lead to further complications. For more detailed guidance on displaying untranslated content, visit Displaying Untranslated Content on Pages in Secondary Languages.

If these solutions do not apply to your situation, or if they become outdated, we highly recommend checking related known issues at https://wpml.org/known-issues/, verifying the version of the permanent fix, and confirming that you have installed the latest versions of themes and plugins. If issues persist, please open a new support ticket at WPML 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.

This topic contains 3 replies, has 2 voices.

Last updated by Bobby 9 months, 3 weeks ago.

Assisted by: Bobby.

Author Posts
August 15, 2024 at 2:32 pm #16074370

dennisE-7

Background of the issue:
I have a WordPress installation with 2 languages, Dutch (default) and English. The Dutch site is filled with content and menus. I added English to translate 1 to 3 important pages. I want to show the Dutch menu on the English pages or be able to add Dutch pages in Appearances -> Menu's while editing the English menu.

Symptoms:
When I get the WP menu items by ID and switch to English, it seeks the translation of that menu.

Questions:
How can I show the Dutch menu on the English pages?
How can I add Dutch pages to the English menu in Appearances -> Menu's?

August 15, 2024 at 6:19 pm #16075781

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

Typically the menu and links in the secondary language will always point to the secondary language.

Right now does your menu have a translation? The problem with adding a translation to the menu is that only existing content will be displayed as available in the secondary language menu.

You might want to enable this feature which will allow the other pages/posts to get pulled to the translated version of the site with the default content:
https://wpml.org/documentation/translating-your-contents/displaying-untranslated-content-on-pages-in-secondary-languages/

August 16, 2024 at 7:25 am #16077034

dennisE-7

Hey,

Thanks for your response.

I've tried multiple combinations from the source you mentioned (see attached images). When I put it on not-translatable I can select the Pages from the other language, but that removes the ability to translate that page.

With the other 2 setting combinations, I can only add English pages to the menu.

There is one option: To create a translation of that page, duplicate it with Dutch content -> And then sync menu's. But it takes alot of work and duplicated content which I then need to put on no-index for English translations -> Alot of work, if I could just show the Dutch menu.

Question: Is there such thing as a trick for now to get menu items by TRID? (https://wpml.org/wpml-hook/wpml_element_trid/)

--

If I press sync menu's, it won't add anything because it can't find the translation (screenshot 4).

screenshot-4.png
Settings-3.png
Settings-2.png
Settings-1.png
August 16, 2024 at 9:22 pm #16079318

Bobby
WPML Supporter since 04/2015

Languages: English (English )

Timezone: America/Los_Angeles (GMT-07:00)

Hi there,

The setting you need is "Translatable
use translation if available or fallback to default language", please do not set pages or posts to "Do not Translate" as that will limit the functionality of WPML as you already noticed.

The menu will not work with sync either because the actual translation is missing.

Also, please do not alter database entries that can create a bigger issue down the road.

Try this workaround:

1. Go to WPML->setting->set pages and posts to "Translatable
use translation if available or fallback to default language"

2. Go to Appearance->Menus and switch to the translated menu and delete it

3. Verify that the default language menu is assigned as a main menu

View the front end now, does it work OK in the translations ?

If that does not work the easiest option will be to duplicate the pages.

To duplicate pages fast you can do it in bulk:

Go to WPML->Translation Management->Select the pages you need and then click on "Duplicate"

Let me know your results, please.

August 19, 2024 at 6:48 am #16082157

dennisE-7

Thanks for your reply, I ended up with using a custom query. These custom queries won't look for translations:

For everyone else who might have this problem in the future, this is the custom database query that I used:

$myrows = $wpdb->get_results( "
SELECT p.*
FROM wp_posts AS p
LEFT JOIN wp_term_relationships AS tr ON tr.object_id = p.ID
LEFT JOIN wp_term_taxonomy AS tt ON tt.term_taxonomy_id = tr.term_taxonomy_id
WHERE p.post_type = 'nav_menu_item'
AND tt.term_id = 161;
" );

Where 161 is the ID of the menu