add_filter( 'wpml_ls_fallback_to_core_template', 'the_callback_function', 10, 3 );
Description
- Filters whether a language switcher whose template is not available (its folder was removed) or whose
template.phpthrows an error shows WPML’s default template of its type instead of nothing. - See more at the Custom language switcher templates document.
Arguments
Three parameters are passed to this filter: fall_back, slot and failed_slug.
$fall_backbooltrue(the default) to show WPML’s default template.falseto keep the switcher empty.$slotWPML_LS_SlotThe switcher being rendered.$failed_slugstringThe slug of the template that could not be used.
Example Usage
add_filter( 'wpml_ls_fallback_to_core_template', '__return_false' );
add_filter( 'wpml_ls_fallback_to_core_template', function ( $fall_back, $slot ) { return $slot->is_footer() ? false : $fall_back; }, 10, 3 );