Support

Account

Home Forums General Issues Options Pages & Custom Fields

Solved

Options Pages & Custom Fields

  • I am confused on something.

    I have 4 custom post types, each of those has its own options page under them. I then created a field group with fields to build a slider. I set these fields to be visible for each of the options pages. However, when I fill out the fields on the first options page and save it, the fields get filled out on ALL the options pages under each post type.

    Here is how I am creating the option pages.

    
    if ( function_exists( 'acf_add_options_sub_page' ) ){
    
        acf_add_options_sub_page(array(
            'title'      => 'Signature Wedding Details',
            'parent'     => 'edit.php?post_type=signature-weddings',
            'capability' => 'edit_posts'
        ));
    
        acf_add_options_sub_page(array(
            'title'      => 'Corporate Event Details',
            'parent'     => 'edit.php?post_type=corporate-events',
            'capability' => 'edit_posts'
        ));
    
        acf_add_options_sub_page(array(
            'title'      => 'Social Event Details',
            'parent'     => 'edit.php?post_type=social-events',
            'capability' => 'edit_posts'
        ));
    
        acf_add_options_sub_page(array(
            'title'      => 'Destination Details',
            'parent'     => 'edit.php?post_type=destinations',
            'capability' => 'edit_posts'
        ));
    }
    

    I am probably doing something silly but I can’t seem to figure it out.

  • Options pages store values in the options table. You cannot use the same field group on multiple options pages because when saving the options on one page they will overwrite options save on another page. You must have a different field group for each options page and the field names of each group must be unique, not the same as other options page.

  • I see that now, thanks.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Options Pages & Custom Fields’ is closed to new replies.