'Variable not working when an integer works fine in Gravity Forms GFAPI::get_entries filter
I am trying to understand why a variable that contains an integer cannot but used to replace the integer in GFAPI::get_entries field_filters value. This works:
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
'mode' => 'any',
array(
'key' => 'gpnf_entry_parent',
'value' => '72'
)
)
);
This does not work:
$child_entry_ID = "{entry_id}";
where $child_entry_ID is 72. Of course
echo $child_entry_ID . "<br />";
prints "72"
$search_criteria = array(
'status' => 'active',
'field_filters' => array(
'mode' => 'any',
array(
'key' => 'gpnf_entry_parent',
'value' => $child_entry_ID
)
)
);
I use it like this
$entry2 = GFAPI::get_entries(33, $search_criteria);
print_r($entry2);
In the case that works, my arrays print correctly, in the case that doesn't work, I get "Array().
Solution 1:[1]
I know this is old, but shouldn't
$child_entry_ID = "{entry_id}";
Actually be:
$child_entry_ID = "{$entry_id}";
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Jomac |
