A reliable hack that I used was to hook into ‘acf/pre_render_fields’ filter which allows you to modify the fields before they are rendered. There you can attach the $post_id to the field itself, then when it comes to rendering it, you can access it on the field.
Crude example
add_filter('acf/pre_render_fields', function($fields, $post_id) {
return array_map(function($field) use ($post_id) {
$field['my_post_id'] = $post_id;
return $field;
), $fields};
}, 10, 2);
add_action('acf/render_field', function($field) {
echo $field['my_post_id'];
});
Yuk, I know! You’ll have to make the function recursive if you want to get to sub fields.
I’ve needed this as well, so I created a custom field setting which allows for conditional logic based on taxonomy. Give it a try when you get a chance.
https://github.com/andrejpavlovic/acf-conditional-logic-advanced
I’ve needed this as well, so I created a custom field setting which allows for conditional logic based on taxonomy. Give it a try when you get a chance.
https://github.com/andrejpavlovic/acf-conditional-logic-advanced
I’ve needed this as well, so I created a custom field setting which allows for conditional logic based on taxonomy. Give it a try when you get a chance.
https://github.com/andrejpavlovic/acf-conditional-logic-advanced
I’ve needed this as well, so I created a custom field setting which allows for conditional logic based on taxonomy. Give it a try when you get a chance.
https://github.com/andrejpavlovic/acf-conditional-logic-advanced
I’ve needed this as well, so I created a custom field setting which allows for conditional logic based on taxonomy. Give it a try when you get a chance.
https://github.com/andrejpavlovic/acf-conditional-logic-advanced
I can confirm that 5.1.7.1 is working fine.
The issue is still present in 5.2.0.
Besides downgrading the plugin version, another workaround is to toggle the conditional to show the required field with the error message and fill it with something. Then toggle back the conditional to what it was before. Now when you submit there won’t be any error message, since all required fields have been filled out regardless of conditional state.
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.