Home › Forums › ACF PRO › Using acf/load_value with Options Pages › Reply To: Using acf/load_value with Options Pages
Hi
the filter ‘acf/load_value’ is used when you are calling ‘get_field’ in the frontend i believed. The proper filter you are looking for is ‘acf/prepare_field’.
https://www.advancedcustomfields.com/resources/acf-prepare_field/
So, your code would look something like:
add_filter('acf/prepare_field/key=field_5a17b5c21950f', 'ek_option_defaults');
function ek_option_defaults($field) {
if ($field['value'] === false) {
$field['value'] = [
[
'field_59e3c02cff5d4' => 'a',
'field_59e3c031ff5d5' => 'a'
],
[
'field_59e3c02cff5d4' => 'b',
'field_59e3c031ff5d5' => 'b'
],
];
}
return $field;
}
Cheers. đ
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!
ACF wouldnât be so widely used in WordPress if it didnât have some pretty amazing capabilities. In this article, we look at a few of the features weâll discuss during â7 things you didnât know you could do with ACFâ at #WPEDecode later this month. https://t.co/5lnsTxp81j pic.twitter.com/Yf0ThPG1QG
— Advanced Custom Fields (@wp_acf) March 16, 2023
© 2023 Advanced Custom Fields.
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.