WPML
SignaturePHP
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.php throws 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_backbool

    true (the default) to show WPML’s default template. false to keep the switcher empty.
  • $slotWPML_LS_Slot

    The switcher being rendered.
  • $failed_slugstring

    The slug of the template that could not be used.

Example Usage

Keep Every Such Switcher EmptyPHP
add_filter( 'wpml_ls_fallback_to_core_template', '__return_false' );
Keep Only the Footer Switcher EmptyPHP
add_filter( 'wpml_ls_fallback_to_core_template', function ( $fall_back, $slot ) {
	return $slot->is_footer() ? false : $fall_back;
}, 10, 3 );