Created
March 21, 2022 07:55
-
-
Save digamber89/ccfaceda3907d9e3d71f45680cb5cd6b to your computer and use it in GitHub Desktop.
Add WPML Language
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function add_lang_facet( $formatted_data, $raw_data, $object_id ) { | |
//wpml compatibility check | |
$args = [ 'element_id' => $object_id, 'element_type' => 'post_id' ]; | |
$language = apply_filters( 'wpml_element_language_code', null, $args ); | |
if ( $language !== null ) { | |
$formatted_data['lang_attribute_filter'] = [ $language ]; | |
} | |
return $formatted_data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment