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);
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 Privacy Policy. If you continue to use this site, you consent to our use of cookies.