Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Wordpress: WPML & Elementor fix for elementor library translations (Header etc..).
<?php
/**
* Wordpress: WPML & Elementor fix for elementor library translations (Header etc..).
*/
function wpml_elementor_library( $theme_template_id ) {
return apply_filters( 'wpml_object_id', $theme_template_id, 'elementor_library', true );
}
add_filter('elementor/theme/get_location_templates/template_id', 'wpml_elementor_library', 10, 1);
/**
* Fix elementor library cahce that saved only the current langauge and overwrite all the others.
*/
function elementor_library_set_suppress_filters( $query ) {
if( $query->query_vars['post_type'] === 'elementor_library'
&& $query->query_vars['meta_key'] === '_elementor_conditions' ) {
$query->set( 'suppress_filters', true );
}
}
add_action( 'pre_get_posts', 'elementor_library_set_suppress_filters' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment