Problem: acf / fields / post_object / query
Hello,
I have a back office problem to retrieve a post list with an acf (reference) custom field.
For now I managed to display the posts with the reference but it’s when I want to make a request that it does not work.
I used the following filter to retrieve references instead of post names:
function my_post_object_result ($ title, $ post, $ field, $ post_id) {
$ reference = get_field ('reference', $ post-> ID);
return $ reference;
}
add_filter ('acf / fields / post_object / result', 'my_post_object_result', 10, 4);
it works well, but I can not use the filter to modify the search query:
function my_post_object_query ($ args, $ field, $ post_id) {
}
add_filter ('acf / fields / post_object / query', 'my_post_object_query', 10, 3);
How can I modify the query to get the reference rather than the name of the post?
Here is an image of my problem: