Don't show Elements if Polylang language doesn't match
This file contains 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
function generate_elements_ignore_languages( $post_id ) { | |
if ( function_exists( 'pll_get_post_language' ) && function_exists( 'pll_current_language' ) ) { | |
$language = pll_get_post_language( $post_id, 'locale' ); | |
if ( $language && $language !== pll_current_language( 'locale' ) ) { | |
return false; | |
} | |
} | |
return $post_id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment