Skip to content

Instantly share code, notes, and snippets.

@dvdpearson
Last active November 22, 2023 20:58
Show Gist options
  • Save dvdpearson/4c0deb41ec1db9c40c8f to your computer and use it in GitHub Desktop.
Save dvdpearson/4c0deb41ec1db9c40c8f to your computer and use it in GitHub Desktop.
Temporary disable WPML's adjust_id functionality in order to let me choose the right locale
global $sitepress;
$translated_term_id = icl_object_id($term_id, $taxonomy, true, $language_code);
remove_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1 );
$translated_term_object = get_term_by('id', $translated_term_id, $taxonomy);
add_filter( 'get_term', array( $sitepress, 'get_term_adjust_id' ), 1, 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment