/*
* acf_get_posts
*
* This function will return an array of posts making sure the order is correct
*
* @type function
* @date 3/03/2015
* @since 5.1.5
*
* @param $args (array)
* @return (array)
*/
________
// validate order
if( $posts && $args['post__in'] ) {
// vars
$order = array();
if(function_exists('wpml_object_id_filter')){
global $sitepress;
$def_lang = $sitepress->get_default_language();
}
// generate sort order
foreach( $posts as $i => $post ) {
if(function_exists('wpml_object_id_filter')){
$order[ $i ] = array_search(wpml_object_id_filter($post->ID, 'page', true, $def_lang), $args['post__in']);
}
else{
$order[ $i ] = array_search($post->ID, $args['post__in']);
}
}
// sort
array_multisort($order, $posts);
}
_______
Hi @belov1988
Thanks a bundle for the sharing the solution on how to add WPML support to the api
This will surely help someone else in the same situation.