Home › Forums › Bug Reports › Fetching value from cloned field in acf/load_field filter › Reply To: Fetching value from cloned field in acf/load_field filter
Hi @acf-support ,
I´ve been testing some more and tried recreating all field groups, manually from scratch on a fresh install.
The same error appears here too.
The contents of the field global_quotes
is set through the options page Theme settings
.
The error only seems to appear if there are values in the global_quotes
field
The filter for acf/load_field which populates the global_quotes_select:
add_filter( 'acf/load_field/name=global_quotes_select', function( $field ) {
$global_quotes = get_field( 'global_quotes', 'option' );
if ( ! $global_quotes ) {
return $field;
}
foreach ( $global_quotes as $i => $quote ) {
$field['choices'][ $i ] = $quote['quote'];
}
return $field;
});
The Options page for Theme Settings:
if ( function_exists( 'acf_add_options_page' ) ) {
acf_add_options_page([
'page_title' => __( 'Theme Settings', 'wptest' ),
'menu_title' => __( 'Theme Settings', 'wptest' ),
'menu_slug' => 'wptest_options',
'capability' => 'manage_options',
'redirect' => false,
'icon_url' => 'dashicons-welcome-widgets-menus',
'position' => 25,
]);
}
I´ve attached all three json-files needed to replicate the error. Could You please try and create everything manually the way I did?
Thanks in advance.
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.