
Hello,
I am trying to dynamically filter a Post Object field by post_parent. The problem I have is that inside the “acf/fields/post_object/query” filter $_GET params don’t seem to work.
I also use “acf/load_field” filter to set the value of this field, also by using $_GET inside, and it works perfectly.
Steps:
1. Access the page: link/?pid=12 ==> $_GET[‘pid’] – this is the post_parent I would like to use
2. On this page, I have a ACF form with a Post Object field
3. I load a value on this field, by using “acf/load_field” filter and $_GET param – It works
4. Inside the “acf/fields/post_object/query” I have this:
$pid = (int) $_GET[‘pid’]; $args[“post_parent”]=$pid; return $args; – it doesn’t work
If I write $args[“post_parent”]=12 – it works perfectly
So the conclusion is that $_GET doesn’t work in “acf/fields/post_object/query”. But it works in “acf/load_field”.
Do you have any idea how could I transmit a parameter inside “acf/fields/post_object/query”?
$post_id doesn’t help, this is a generic add / edit post page. I am using $_GET params as identifiers.
Thank you!