Please make sure to update to WPML 4.3.6 and check our list of Known Issues before reporting

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 4 replies, has 2 voices.

Last updated by Paul 10 months, 3 weeks ago.

Assigned support staff: Riffaz.

Author Posts
April 8, 2019 at 12:00 pm #3557419


The WPML plugin has the neat option of automatically adding the language switcher at the end of the menu. In most cases that's fine.

However, for the MAIN Menu it is often the case that we want the FURTHEST RIGHT element in that part of the screen to be a Call-to-Action button/link.

How can I append such a link AFTER the menu switcher has appended itself?
I assume that there is a way to do so with some custom code in functions.php?
See page:
hidden link

Please note we ONLY want this CTA to appear in the Main Menu, not in the Nav Widget which is used in the footer.

April 8, 2019 at 12:48 pm #3557823


Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)


Thank you for contacting WPML support.

WPML uses default WordPress menu.
By default it does not add anything after the language switcher in default WP menu.

In this case, you have to create your own custom language.
We can guide you how to create it but we can not create it for you since it's really a custom work.
Please refer:

This also may help :

If you are unable to get it work we highly recommend you to check this out :

Let me know you need anything else regarding this within the support scope.


April 9, 2019 at 1:56 am #3561947


OK. I got it to work like this:

function new_nav_menu_items($items)
	if (function_exists('icl_get_languages')){
		if ( defined( 'ICL_LANGUAGE_CODE' ) ) {
  			$this_language = ICL_LANGUAGE_CODE;
  			if ($this_language=='en'){
				$items .= '<ul><li class="menu-item menu-item-language nav-cta"><a class="nav-cta-link" href="#">EN CTA here</a></li></ul>';
			if ($this_language=='ja'){
				$items .= '<ul><li class="menu-item menu-item-language nav-cta"><a class="nav-cta-link" href="#">JA CTA here</a></li></ul>';
	   	return $items;
add_filter('wp_nav_menu_items', 'new_nav_menu_items');

When I used this:

$languages = apply_filters( 'wpml_active_languages', NULL, 'skip_missing=0&orderby=code' );
$current_language = apply_filters('wpml_current_language');

I got WSOD.

Are 'wpml_active_languages' and 'wpml_current_languages' valid?

April 10, 2019 at 12:25 pm #3575983


Languages: English (English )

Timezone: Asia/Colombo (GMT+05:30)


That's all good.
There is a small missing param.

you just need to supply the NULL

$current_language = apply_filters('wpml_current_language', NULL );

I recommend you to enable WP_DEBUG
So you can see the error messages while you are adding code.
when everything works, you can remove WP_DEBUG again

if you had WP_DEBUG turned on, you would seen "missing parameter" instead of a WSOD

Hopefully, this will help.


April 10, 2019 at 12:39 pm #3576173


Thanks for ALL the advice.
Much appreciated.

You can close the ticket.