WordPress ACFNotice: get_field() - We've detected one or more calls to retrieve ACF field values before ACF has been initialized
PHP Snippet 1:
add_action( 'acf/init', 'custom_code' );
function custom_code() {
acf_add_local_field_group(array(
'key' => 'group_1',
'title' => 'Page Hero',
'fields' => array (
array (
'key' => 'field_1',
'label' => 'Hero Title',
'name' => hero_title,
'type' => 'text',
)
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => page,
),
),
),
));
}