Last active
February 3, 2019 05:06
-
-
Save DevWael/eb5537b7b86feeb0c7aad51eba542755 to your computer and use it in GitHub Desktop.
Get the translated post id of the given object id (the object id can be a post type or category or tag etc...)(WPML only)
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
<?php | |
function prefix_lang_object_ids($object_id, $type) { | |
if( is_array( $object_id ) ){ | |
$translated_object_ids = array(); | |
foreach ( $object_id as $id ) { | |
$translated_object_ids[] = apply_filters( 'wpml_object_id', $id, $type, true, $current_language ); | |
} | |
return $translated_object_ids; | |
} else { | |
return apply_filters( 'wpml_object_id', $object_id, $type, true, $current_language ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment