Support

Account

Home Forums ACF PRO Different values for same field groups on different options pages? Reply To: Different values for same field groups on different options pages?

  • The slug of the options page itself doesn’t affect any of the content within, it just determines what the URL of the options page is in the backend.

    All of the actual fields are just saved into the wp_options table in the database using the field name from ACF. This means if you use the same field with the same field name on multiple options pages (irrespective of the actual page slug) this will be overwritten.

    <?php the_field('title', 'options'); ?>

    This is why I said, make two separate forms in ACF with the same fields in, but with different slugs. This would be something like:

    
    Options page (Posts)
        - title_post
        - description_post
    
    Options page (Pages)
        - title_page
        - description_page
    

    This effectively allows you to keep the slug the same per options page, whilst incorporating the post-type of the page that this options page will appear in, to keep them unique.

    Then when you call in this information, you can use the block I added earlier to specify which fields to look at:

    get_field( 'description_' . get_post_type($post), 'options' );

    On a posts page this will give you

    get_field('description_post', 'options);

    and on a page:

    get_field('description_page', 'options);