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 39 replies, has 3 voices.

Last updated by Andrey 1 year ago.

Assigned support staff: Andrey.

Author Posts
September 11, 2018 at 1:36 pm

karinC-2

Hi,

We are having some serious issues with multi-language menus, and I hope you can help.

## Overview

WP Multisite setup as follows:

-   Main site
    -   Child site A
    -   Child site B
    -   Child site C
    -   Child site D
    -   Child site E

Using WPML plugins:

- Multilingual CMS v4.0.6
- String Translation v2.8.6
- Translation Management v2.6.6
- Advanced Custom Fields Multilingual v0.8 (as almost all of our content is using ACF)

All sites are using the same custom theme, and the same 4 languages (original content in English, then translations for French, Spanish, and Portuguese). Theme strings are translated under 'String Translation' on the main site, and then manually imported into each child site.

## Problem

We have a common footer on all sites, which contains 2 menus from the main site; 'Footer Info' and 'Social Links'. There are translations of the 'Footer Info' menu, 'Social Links' is English only. These menus break in inconsistent ways, depending on whether you are on the main site, or a child site, and the current language.

- Main - Only En exists - Working as expected
- Child A - En/Fr/Pt/Es - Error with both menus
- Child B - En/Fr/Pt/Es - Both menus missing
- Child C - En/Fr/Pt/Es - Error with both menus
- Child D - Only En exists - Error with both menus
- Child E - Only En exists - Error with both menus

The remaining language pairs are still in progress.

The errors are:
(<site root> represents the root dir of the WP install)

Notice: Undefined property: stdClass::$term_id in <site root>/wp-includes/nav-menu-template.php on line 123

Sometimes (but not always), this one right next to it too:

Notice: Undefined property: stdClass::$slug in <site root>/wp-includes/nav-menu-template.php on line 198

The symptoms have changed after the latest update to WPML plugins. Previously, sometimes the menus would appear correctly, sometimes the wrong menu would be loaded or individual menu items would be missing. Today we are getting the errors above, and I cannot create any new menus on the main site, or any child site - there is no error, but the menu is not created. I have tried creating a brand new child site, and these issue still exist, before I start adding content.

Please let me know what you need to investigate this strange issue.

Many thanks,

Rik

September 12, 2018 at 10:58 pm #2729207

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hello,
Thank you for contacting WPML support.

I just visited the site and the error message is inside the theme used (inc/atomic/footer-info-nav.php on line 4).

Is this a custom theme?

Kind regards,
Carlos

September 13, 2018 at 9:42 am #2730806

karinC-2

Hi Carlos,

Thanks for taking a look. Yes it is a custom theme, based on underscores.

Where did you see an error relating to line 4 of inc/atomic/footer-info-nav.php ?

Here is the code from that file:

<?php
function icmm_footer_info_nav() {
	$blog = get_active_blog_for_user( get_current_user_id() );
	$current_blog_id = $blog->blog_id;
	if ($current_blog_id == 1) {
		$on_mothership = true;
	} else {
		$on_mothership = false;
	}
	// Additional tasks if we're not on the mothership
	if ( !$on_mothership ) {
		// Note the current language
		$lang = ICL_LANGUAGE_CODE;
		// Switch to the mothership
		switch_to_blog(1);
		// Change to the current language
		global $sitepress;
		$sitepress->switch_lang($lang);
	}

	// Generate menu
	wp_nav_menu( array(
		'theme_location' => 'footer-info-nav',
		'container'		 => false,
		'menu_id'        => '',
		'menu_class' => 'list-unstyled'
	) );

	if ( !$on_mothership ) {
		// Reset to current blog
		restore_current_blog();
	}
}
?>
September 13, 2018 at 3:37 pm #2732236

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi,

The error message comes from the page (see attached image).

It seems -unfortunately- that for now you need custom programming work which is beyond the scope of our support.

At this point I would suggest you consider contacting one of our certified partners from this link: http://wpml.org/documentation/support/wpml-contractors/

Before doing so please have a look also here:
http://wpml.org/documentation/support/wpml-contractors/guidelines-for-people-looking-for-consulting-help/

You will get the custom assistance you need to get on with your project.

Please let me know if you need further assistance and I will be more than happy to help.
Best regards,
Carlos

September 13, 2018 at 4:24 pm #2732375

karinC-2

I think you may have misunderstood, this was all working great until WPML was introduced.

Your screenshot seems to be missing.

Please escalate to higher level support.

Many thanks.

September 13, 2018 at 11:14 pm #2733233

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi,

I'm sorry, it seems I misunderstood the issue. Please accept my apologies.

I would like to ask you to follow this steps in order to isolate the cause of the issue:
- Back up your site first before making any change, this is for security reasons.
- Deactivate all the plugins that are not related to WPML.
- Switch for a moment to a WordPress default theme like Twenty Seventeen.
- If the issue is gone, activate one by one to see with which one there is an interaction issue.

Could you tell me the result of this steps?

Note: I have attached the image again (it looks like it failed in my last message).

Looking forward to your answer.
Best regards,
Carlos

September 13, 2018 at 11:15 pm #2733245

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Please, let me know if you see the attached image in my previous message.

Regards,
Carlos

September 14, 2018 at 11:11 am #2735203

karinC-2

Thanks for the screenshot, Carlos, I can see it this time. I was not getting that error, but thanks to your report, I have updated the footer_info_nav function and we are now back to the behavior we have been seeing over the past week.

Just to be clear, the footer menu is now behaving as follows:

Main site - En/Fr/Pt/Es - Working as expected (only sub-pages have translations)
Child A - En/Fr/Pt/Es - Working as expected
Child B - En - Wrong menu loaded (loads the main nav of the main site)
Child B - Fr - Working as expected, although twitter link is missing from the social menu
Child B - Pt/Es - No menu loaded
Child C - En - Wrong menu loaded (loads a different nav from the main site)
Child C - Fr - Wrong menu loaded (loads the social_links nav from the main site)
Child C - Es - Error: Undefined property: stdClass::$slug in <site root>/wp-includes/nav-menu-template.php on line 198
Child D - En - Wrong menu loaded (loads a different nav from the main site)
Child E - En - Wrong menu loaded (loads a different nav from the main site)

The main site and child A are both working as expected in all languages. Child B seems to break in the most inconsistent way.

I have tried disabling all but WPML plugins, but the problem persists. If I change to twentyseventeen theme, I can create new menus in the dashboard, but obviously, I cannot test the footer menus.

September 14, 2018 at 1:24 pm #2735489

karinC-2

I should add that if you need to create a local copy of the site for testing, please download the latest Duplicator backup from Network Admin.

September 14, 2018 at 6:11 pm #2736397

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi,
Thank you very much for your feedback.

I'm downloading the latest Duplicator package. My next step will be to try to reproduce the issue in a local environment and then isolate its cause. This way I won't affect the live site.

I will get back to you as soon as I have an answer.

Thank you very much for the copy of the site and your authorization to download it.

Best regards,
Carlos

September 17, 2018 at 1:18 pm #2741091

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi there,

I installed the copy of the site on local but I can't load the front end of the site because I get errors related to get_field() and the_field() functions. It seems like ACF plugin is not activated.

I would like to ask you to double check if ACF plugin was deactivated while the Duplicator package was created. Also, I kindly ask you to double check the users roles, as none of them seems to have admin role in the copy of the site.

Looking forward to your answer.
Best regards,
Carlos

September 18, 2018 at 10:35 am #2744544

karinC-2

Hi Carlos,

Apologies, I have now added you as super admin to all the sites individually.

Yes, ACF Pro was definitely active when the backup was made. I have just created a fresh package, so please download this for your testing.

The "live" site is still in development and not publicly accessible yet, so feel free to look around there if there any problems with the backup.

Many thanks.

September 18, 2018 at 10:02 pm #2746628

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi,
Thank you very much for creating a new Duplicator package.

I'm downloading the copy of the site and I will try to reproduce the issue on local and isolate its cause. I will get back to you as soon as possible.

Best regards,
Carlos

September 19, 2018 at 4:46 pm #2749512

Carlos Rojas
Supporter

Languages: English (English ) Spanish (Español )

Timezone: America/Montevideo (GMT-03:00)

Hi,

I'm sorry but the fatall error related to the get_field() function persists in the new copy of the site in local. I can't see the site.

Regards,
Carlos

September 20, 2018 at 9:37 am #2751625

karinC-2

Can you give me more details about the error? Perhaps it is a licensing issue with ACF Pro? Do you have a Pro license key to use for testing?

As I mentioned above, the "live" site is still in development, and is not public yet. Feel free to look at the live site for comparison.