Same ACF Relationship field for multiple Post Options sub-pages?

Question

How can I ensure that the data saved by an Advanced Custom Fields Relationship field, when on an Options page for a Post type, is separate?

Detail below:

I have an ACF field group, “Features”, containing a Relationship field.

It is intended to allow me to pre-set some featured posts for a couple of custom post types – “Reports” and “Articles”.

For those post types, in the same code that registers each post type, I have created an Options sub-page like this…

// Support showcase Features for this post type, via ACF

if( function_exists('acf_add_options_page') ) {

    // add sub page
    acf_add_options_sub_page(array(
        'page_title'    => 'Articles Features',
        'menu_title'    => 'Articles Features',
    'menu_slug'   => 'articles-features',
    'capability'  => 'edit_posts',
        'parent_slug'   => 'edit.php?post_type=article',
    'position'    => false,
    'icon_url'    => false
    ));

}

The same goes for “Reports”.

And then I apply the “Features” field group to both Options sub-pages – “Articles Features” and “Reports Features”.

The problem is… the data is the same.
That is, the six Relationship posts set for “Reports Features” also show up in the Options sub-page for “Articles Features”. Changing one Relationship field overwrites the other.

How can I ensure that these two things are separate, so that I can save the features distinctly per post type, without recreating the field group?

0
Robert Andrews 1 month 0 Answers 8 views 0

Leave an answer