I need to add fields with php in two pages (in advanced custom fields plugin , wordpress )
Here is my try :
acf_add_local_field_group(array (
'key' => 'songs_options',
'title' => 'songs options',
'fields' => array (
array (
'key' => 'field_1',
'label' => 'test title',
'name' => 'test_field',
'type' => 'text',
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => 'IN',
'value' => array( 'songs', 'videos'), // i need a code like this line
),
)
),
));
You should use the '==' operator with the locations, and add every locations as a different array under 'location':
register_field_group(array (
'key' => 'songs_options',
'title' => 'songs options',
'fields' => array (
array (
'key' => 'field_1',
'label' => 'test title',
'name' => 'test_field',
'type' => 'text',
),
),
'location' => array (
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'songs',
),
),
array (
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'videos',
),
),
),
));
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.