Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // WPML Plugin - Get the ID of original Post
- global $sitepress; // Assuming the plugin is active
- $original_post_id = apply_filters(
- 'wpml_object_id',
- get_the_id(),
- get_post_type(get_the_id()),
- false,
- $sitepress->get_default_language()
- );
- echo '$original_post_id - ' . $original_post_id;
- --------------------------
- // Get translated post ID
- -------------------------
- global $sitepress; // Assuming the plugin is active
- $element_obj = get_page_by_path( 'news' );
- $element_id = $element_obj->ID;
- $element_type = get_post_type($element_id);
- ----------------------------------
- // Get term id of custom taxonomy
- ----------------------------------
- $translated_term_id = apply_filters( 'wpml_object_id', ORIGNAL_TERM_ID, 'TAXONOMY_NAME', false );
- $return_original_if_missing = true;
- $ulanguage_code = ICL_LANGUAGE_CODE;
- $post_id = apply_filters( 'wpml_object_id', $element_id, $element_type, $return_original_if_missing, $ulanguage_code );
- echo '$post_id - ' . $post_id;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement