This snippet helps you define custom fields in your theme or plugin, streamlining field creation without using the ACF interface.
if (function_exists('acf_add_local_field_group')) {
acf_add_local_field_group(array(
'key' => 'group_1',
'title' => 'Custom Fields Group',
'fields' => array(
array(
'key' => 'field_text',
'label' => 'Text Field',
'name' => 'text_field',
'type' => 'text',
),
array(
'key' => 'field_image',
'label' => 'Image Field',
'name' => 'image_field',
'type' => 'image',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
),
),
));
}