Skip Navigation

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.

Tagged: 

This topic contains 5 replies, has 2 voices.

Last updated by Long Nguyen 8 months ago.

Assisted by: Long Nguyen.

Author Posts
August 30, 2023 at 7:05 am

markH-6

Hi..
Ok, I just realised that I had the updates channel set to BETA. It has been this way for a while actually since WPML had a major vulnerability ages ago.
I changed it to Production but I can not get the menus to sync or the pages etc to update the translations. Totally my fault. I should have changed this back ages ago!

August 30, 2023 at 7:43 am
August 30, 2023 at 7:45 am #14310827

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

Please make a full backup of your site and database then share the backup file with me. I will restore your site on my local host and investigate the issue further. Your next reply is set to private to share the info.

You can use this plugin to create the backup: https://wordpress.org/plugins/duplicator/

Look forward to your reply.
Thanks

August 30, 2023 at 7:57 am #14310941

markH-6

Hi Long,
It is not allowing me to make a duplicate. Must be server restrictions?
Shall I provide FTP for you?

Screenshot 2023-08-30 at 9.56.02 AM.png
August 30, 2023 at 9:19 am #14311773

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I can take a backup file on your site with the plugin All In One WP Migration and restore it on my local site. After trying some steps to troubleshoot the issue, it still does not work.
I'm asking our 2nd tier support about this issue and update you here when I have something to share.

Thanks.

August 30, 2023 at 9:20 am #14311779

markH-6

Awesome. Thanks!

August 31, 2023 at 2:59 am #14316693

Long Nguyen
Supporter

Languages: English (English )

Timezone: Asia/Ho_Chi_Minh (GMT+07:00)

Hi,

I got some information from our 2nd tier support: this is a database corruption issue and please follow the workaround below to fix this.

❌ IMPORTANT: Please backup your database and website before proceeding ❌

- Edit the file wp-content/plugins/sitepress-multilingual-cms/inc/wp-nav-menus/wpml-menu-sync-functionality.class.php

- Around line 467-481, replace the code:

private function get_menu_item_depth( $item_id ) {
	$depth = 0;
	do {
		$object_parent = get_post_meta( $item_id, '_menu_item_menu_item_parent', true );
		if ( $object_parent == $item_id ) {
			$depth = 0;
			break;
		} elseif ( $object_parent ) {
			$item_id = $object_parent;
			$depth ++;
		}
	} while ( $object_parent > 0 );

	return $depth;
}

with this one

private function get_menu_item_depth( $item_id ) {
	$depth = 0;
	$processed = [];  // To keep track of visited menu items

	do {
		$object_parent = get_post_meta( $item_id, '_menu_item_menu_item_parent', true );

		// Detect circular reference and break the loop
		if (in_array($item_id, $processed)) {
			$depth = 0;  // or perhaps a special value to indicate an error
			break;
		}

		// Mark the current item as processed
		$processed[] = $item_id;

		if ( $object_parent == $item_id ) {
			$depth = 0;
			break;
		} elseif ( $object_parent ) {
			$item_id = $object_parent;
			$depth++;
		}
	} while ( $object_parent > 0 );

	return $depth;
}

then you can access the page WPML > WP Menus Sync again.

Look forward to your reply.
Thanks

August 31, 2023 at 8:43 am #14318373

markH-6

Hey Long & Team...
Awesome. Worked like a charm.
Many thanks for the quckk support!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.