Created
July 12, 2019 13:06
-
-
Save srdjan-jcc/178d0435c0971593acb67195577b9418 to your computer and use it in GitHub Desktop.
Uncode 'wpml_object_id' implementation
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 | |
add_filter( 'uncode_wpml_object_id', 'uncode_wpml_object_id', 5 ); | |
function uncode_wpml_object_id( $post_id ) { | |
if ( did_action( 'wpml_loaded' ) ) { | |
$post_type = get_post_type( $post_id ); | |
$wpml_setting = apply_filters( 'wpml_setting', array(), 'custom_posts_sync_option' ); | |
if ( is_array( $wpml_setting ) && array_key_exists( $post_type, $wpml_setting ) ) { | |
$return_original = $wpml_setting[ $post_type ] == WPML_CONTENT_TYPE_DISPLAY_AS_IF_TRANSLATED; | |
return apply_filters( 'wpml_object_id', $post_id, $post_type, $return_original ); | |
} | |
} | |
return $post_id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment