Home › Forums › General Issues › Default values for sub field: Post Object › Reply To: Default values for sub field: Post Object
I’m not sure if this is helpful to you, but I just got a similar filter to work when the Post Object sub-field of the Repeater has the Return Format set to “Post ID”. With this setting, I just passed in the appropriate post_id as the value in the filter. So with your code above it’d be something like:
if ($value === false) {
$value = array();
$post_id_1 = 28;
$post_id_2 = 24;
$value[] = array(
'field_5e23ef3a22ea6' => $post_id_1, // post_id of the 1st Gas post that you want to choose
'field_5e23f00922ea7' => '0'
);
$value[] = array(
'field_5e23ef3a22ea6' => $post_id_2, // post_id of the 2nd Gas post that you want to choose
'field_5e23f00922ea7' => '0'
);
}
return $value;
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.