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
        '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?

1 Answer 1


The method to use is...

In the acf_add_options_sub_page declaration, add 'post_id' => 'article' as a parameter. (post_id)

This is how the field data, as entered on the Options page corresponding to my post type, will be saved.

On the display end, display using $featured_posts = get_field('featured_posts', 'article');

'article' and 'report' are both used.

In my case, at the display end, I use $queried_object->name to dynamically infer either 'article' or 'report' post types.

Credit hube2

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.