Created
October 18, 2014 19:05
-
-
Save dendeffe/643ab9ae84312b2a0add to your computer and use it in GitHub Desktop.
ACF-hook to filter the query of a posts field
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
function test_field( $args, $field, $post ) { | |
// modify the order | |
$args['orderby'] = 'date'; | |
$args['order'] = 'DESC'; | |
$args['posts_per_page'] = 2; | |
return $args; | |
} | |
add_filter('acf/fields/post_object/query/key=field_5442b71190417', 'test_field', 10, 3); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment