WPML
do_action( 'wpml_add_language_form_field' )
Type
action
WPML Version
3.2

Description

Echoes an HTML hidden input field with name=”lang” and as value the current language.

In order to add a search form to your theme you would normally use the standard WordPress template tag: get_search_form()

If you are making use of the default WordPress search form, you do not need to edit anything. WPML will handle the rest.

However, there may be times when get_search_form() can’t be used. If you are creating a custom search form and you need to make it WPML compatible then this action hook is what you need.

Arguments

This action hook does not have any parameters.

Example usage

Add the code below inside your search form code.

Example
// Return the HTML code for the current language Spanish
// <input type='hidden' name='lang' value='es' />
do_action( 'wpml_add_language_form_field' );

wpml_decode_custom_field, wpml_footer_language_selector, wpml_ls_exclude_in_menu, wpml_is_rtl, wpml_alternate_hreflang, wpml_head_langs, wpml_must_translate_canonical_url, wpml_browser_redirect_language_params, wpml_active_languages, wpml_encode_custom_field

All 29 Site-Wide Language Information hooks →