Skip to content

Instantly share code, notes, and snippets.

@tyxla
Created August 14, 2015 11:28
Show Gist options
  • Save tyxla/2dca62365e78204a5599 to your computer and use it in GitHub Desktop.
Save tyxla/2dca62365e78204a5599 to your computer and use it in GitHub Desktop.
Very ugly fix for Carbon_Field_Association together with WPML on the Widgets page in the administration.
<?php
# Resolving WPML and Carbon_Field_Association incompatibilities
add_filter('get_terms', 'crb_fix_get_terms_wpml', 0);
function crb_fix_get_terms_wpml($terms) {
global $wp_filter, $sitepress;
if ( is_admin() && !empty($sitepress) && !empty( $wp_filter['get_terms'] ) ) {
foreach ($wp_filter['get_terms'] as $priority => $callbacks) {
foreach ($callbacks as $callback_key => $callback) {
if ( !empty($callback['function'][0]) && $callback['function'][0] instanceof iclNavMenu ) {
unset( $wp_filter['get_terms'][$priority][$callback_key] );
}
}
}
}
return $terms;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment