Skip to content

Instantly share code, notes, and snippets.

@kagg-design
Created October 31, 2019 15:04
Show Gist options
  • Save kagg-design/7e0807d6e6308c338d12a8179f9c797b to your computer and use it in GitHub Desktop.
Save kagg-design/7e0807d6e6308c338d12a8179f9c797b to your computer and use it in GitHub Desktop.
Fix performance issue in Jupiter X with WPML and Polylang. Replace code of \CustomizerMultilingual::get_custom_customizer_option
<?php
protected function get_custom_customizer_option() {
static $theme_slug = null;
$current_language = self::get_language();
if ( ! $theme_slug ) {
$theme_slug = get_option( 'template' );
}
$option_prefix = str_replace( '-', '_', $theme_slug );
$option_name = $option_prefix . self::get_option_key() . $current_language;
$value = wp_cache_get( $option_name, 'CustomizerMultilingual', false, $found );
if ( $found ) {
return $value;
}
$value = get_option( $option_name, false );
wp_cache_set( $option_name, $value, 'CustomizerMultilingual' );
return $value;
}
@ScKoDEV
Copy link

ScKoDEV commented Nov 21, 2019

Perfect, thank you very much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment