How can I prevent a custom link in menu from localization?

Home/How can I prevent a custom link in menu from localization?

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

A: You can use this piece of code with wpglobus_nav_menu_objects filter as example.

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 code for your needs.

2016-10-24T05:58:22+00:00 April 29th, 2016|