Skip to content

Instantly share code, notes, and snippets.

@joseyaz
Created February 9, 2018 20:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joseyaz/823ab1a2b03d75d547fccf8a0611af61 to your computer and use it in GitHub Desktop.
Save joseyaz/823ab1a2b03d75d547fccf8a0611af61 to your computer and use it in GitHub Desktop.
function my_relationship_query( $args, $field, $post_id ) {
// only show children of the current post being edited
$args['post_date'] = 'DESC';
// return
return $args;
}
// filter for every field
add_filter('acf/fields/relationship/query', 'my_relationship_query', 10, 3);
@mwangepatrick
Copy link

Try setting the params as


 $args['orderby'] = 'post_date';
 $args['order'] = 'DESC';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment