I am trying to get all posts with the same ACF inside. E.g. ideally I need an archive page, or a custom category page, with posts which contain given field.
Was trying to follow steps shown here: http://www.advancedcustomfields.com/resources/acf-fields-post_object-query/
And created filters in functions.php as described there:
function my_post_object_query( $args, $field, $post )
{
// modify the order
$args['orderby'] = 'title';
return $args;
}
// filter for every field
add_filter('acf/fields/post_object/query', 'my_post_object_query', 10, 3);
// filter for a specific field based on it's name
add_filter('acf/fields/post_object/query/name=my_select', 'my_post_object_query', 10, 3);
// filter for a specific field based on it's key
add_filter('acf/fields/post_object/query/key=field_508a263b40457', 'my_post_object_query', 10, 3);
But don't quite understand how to get posts on some given page... e.g. localhost/?<customfieldname>=<customfield_value>