Created
August 14, 2015 11:28
-
-
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.
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
<?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