Home › Forums › General Issues › Issue with import – ACF on multipule custom taxonomies
Hi All,
I was wondering if someone could tell me what is wrong with this bit of code. I’m building a new site for a client, their current site is using ACF 3.5.0 and we are using 4.3.8. Their current site is controlled by another agency so I do not have the ability to update plugins. I wouldn’t suspect the versions have much to do with this but I feel like I need to mention it since the syntax is probably a combination of old and new.
I’m trying to import a custom post type that uses custom taxonomies. The ACF meta box should appear on all custom post types: ‘resources’ as long as the ‘taxonomy’ is 5, 9, 7 or 8. Currently the box is only showing up on the first taxonomy e.g., #5. I’m thinking I have some sort of syntax error since if I change #5 to any of the other taxonomies that I’m also trying to use, the box will show up on those pages but none of the others. It’s almost like it’s reading the first rule and then ignoring the rest of the rules.
anyway here is the code:
register_field_group(array (
'id' => '53f2457e40ce2',
'title' => 'Video Settings',
'fields' =>
array (
0 =>
array (
'choices' =>
array (
0 => 'YouTube',
1 => 'Vimeo',
2 => 'Wistia',
),
'label' => 'Video Service',
'name' => 'video_type',
'type' => 'select',
'instructions' => '',
'required' => '0',
'default_value' => '0',
'allow_null' => '0',
'multiple' => '0',
'key' => 'field_5193cf527d106',
'order_no' => '0',
),
1 =>
array (
'key' => 'field_5065bafb17f83',
'label' => 'Video URL',
'name' => 'video_url',
'type' => 'text',
'instructions' => 'e.g. http://www.youtube.com/watch?v=video_id',
'required' => '0',
'default_value' => '',
'formatting' => 'none',
'order_no' => '1',
),
),
'location' =>
array (
'rules' =>
array (
0 =>
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'resources',
'order_no' => '0',
'group_no' => 0,
),
1 =>
array (
'param' => 'taxonomy',
'operator' => '==',
'value' => '5',
'order_no' => '1',
'group_no' => 0,
),
),
array (
0 =>
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'act_resources',
'order_no' => '0',
'group_no' => 1,
),
1 =>
array (
'param' => 'taxonomy',
'operator' => '==',
'value' => '9',
'order_no' => '1',
'group_no' => 1,
),
),
array (
0 =>
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'act_resources',
'order_no' => '0',
'group_no' => 2,
),
1 =>
array (
'param' => 'taxonomy',
'operator' => '==',
'value' => '7',
'order_no' => '1',
'group_no' => 2,
),
),
array (
0 =>
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'act_resources',
'order_no' => '0',
'group_no' => 3,
),
1 =>
array (
'param' => 'taxonomy',
'operator' => '==',
'value' => '8',
'order_no' => '1',
'group_no' => 3,
),
),
'allorany' => 'all',
),
'options' =>
array (
'position' => 'normal',
'layout' => 'default',
'hide_on_screen' =>
array (
),
),
'menu_order' => 0,
));
* FYI: I did remove some fields to make it shorter
I also tried this:
'rules' =>
array (
0 =>
array (
'param' => 'post_type',
'operator' => '==',
'value' => 'act_resources',
'order_no' => '0',
'group_no' => 0,
),
1 =>
array (
'param' => 'taxonomy',
'operator' => '==',
'value' => '5',
'order_no' => '1',
'group_no' => 0,
),
2 =>
array (
'param' => 'taxonomy',
'operator' => '==',
'value' => '9',
'order_no' => '1',
'group_no' => 0,
),
3 =>
array (
'param' => 'taxonomy',
'operator' => '==',
'value' => '7',
'order_no' => '1',
'group_no' => 0,
),
4 =>
array (
'param' => 'taxonomy',
'operator' => '==',
'value' => '8',
'order_no' => '1',
'group_no' => 0,
),
),
Which lead to the metabox only being displayed on the last taxonomy (#8)
Any help would be appreciated. Thanks!
The topic ‘Issue with import – ACF on multipule custom taxonomies’ is closed to new replies.
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!
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.