How can I prevent localization of a custom menu link?

/How can I prevent localization of a custom menu link?

Q: How can I tell WPGlobus not to localize custom links in a menu?

A: For example, you can use this code snippet with the wpglobus_nav_menu_objects filter:

add_filter( 'wpglobus_nav_menu_objects', 'filter__wpglobus_nav_menu_objects' );
function filter__wpglobus_nav_menu_objects( $menu_items ) {
	
	if ( WPGlobus::Config()->default_language == WPGlobus::Config()->language ) {
		return $menu_items;
	}
	
	foreach ( $menu_items as $key => $item ) {
		$menu_items[ $key ]->url = WPGlobus_Utils::localize_url( $menu_items[ $key ]->url, WPGlobus::Config()->default_language );
	}	
	
	return $menu_items;
}

Please modify the above code for your needs.
You need to place this code to the functions.php file in your active theme.
But don’t forget about Child Themes

2018-02-02T04:17:24+00:00 February 1st, 2018|