Last active
March 4, 2020 19:27
-
-
Save isotrope/0009b41baa7c054fec9c86f1ded519e8 to your computer and use it in GitHub Desktop.
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 | |
// ....genre.... | |
function get_unsub_page_url_in_current_language() { | |
$unsub_page_id = get_option( 'my_prefix_unsub_page_id', false ); | |
if ( function_exists( 'pll_get_post' ) ) { | |
// polylang | |
// https://polylang.wordpress.com/documentation/documentation-for-developers/functions-reference/ | |
$translated_page_id = pll_get_post( $unsub_page_id ); | |
} else if ( function_exists( 'icl_object_id' ) ) { | |
// wpml | |
// https://wpml.org/wpml-hook/wpml_object_id/ | |
$translated_page_id = apply_filters( 'wpml_object_id', $unsub_page_id ); | |
} else { | |
// default | |
$translated_page_id = $unsub_page_id; | |
} | |
return get_permalink( $translated_page_id ); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment