Support

Account

Home Forums Add-ons Options Page Options Page Fields Need Unique Names Reply To: Options Page Fields Need Unique Names

  • In the case of options pages, acf is just a wrapper for the WP functions get_option() and update_option(). There is nothing built into these functions that allows for duplicate field names. In fact, the database is set up so that the “option_name” value must be unique.

    There is a work-a-round for this that is not well known. When saving options ACF prefixes the option name with “options_”. You can alter this by altering the post ID used for the options page. This is one of the settings when adding an options page. For example, if you used the post ID of one page or “theme_options” and the post ID of “some_other_options” for a second page and both options pages have a field name “some_field_name” ACF will store one at “theme_options_some_field_name” and the other at “some_other_options_some_field_name”

    You just need to give the correct post ID when getting these options, instead of get_field('my_field', 'options') you would do get_field('my_field', 'theme_options')