I have a Theme Options page with many options. All works fine when options are configured. However, if (whilst developing) I decide to add a new field within the Theme Options page, many of the other fields that are already set get mixed up. I have settings for colours within the site and these all get messed up (that’s the first indication that eveything is wrong when the site completely changes colour), as well as many of the other fields. Subsequent removal of new field doesn’t corrrect the error.
I don’t seem to have this issue if I add a new field within custom fields on a post or page – it only seems to cause an error on the Theme Settings page.
Is there somethng I’m not doing correctly here?
How are you getting the options? Are you using
get_fields()? If you are you cannot depend on this function to return field values in a specific order, especially after adding fields to a field group where the other fields already have values.
Other than this I’d need more information about the fields, how your using them and specifics about how they are mixed up.
Hi John, thanks for the reply.
Is it relevant how I’m getting the field (using get_fields()) when the issue I see is in the display of the Options Page itself (regardless of how the settings are used within the website)? The options all tend to be within groups, so are accessed using get_sub_field() calling each field by name, so I don’t think there’d be any conflict there.
The mixing up of the fields only tends to happen when I add a new field within the Theme Options page, but I don’t notice any issue until I view the Options page and configure the new field, then save. This messes up (for example) the colour schemes I have… there are lots of options of colours to set, and today (and in the past) the colour values seem to be shifted by 2 fields. (I’m not quite savvy or confident enough to edite the SQL tables to correct this, so I have to copy and paste all colour values along 2 over several tabs – doable, but a pain).
The data mixing isn’t restricted to the colours – other options are mised too (text fields suddenly have hex values rather than titles).
Would it be relevant that: a) the colour schemes are a ‘clone’ field; and b) as well as having a ‘Default’ colour scheme, there are cloned schemes on a repeater for pages/sections with different background colours.
I appreciate this may be difficult to fully understand from my words… is tere any other specifc information you think I need to provide?
I’m using both Prefix Field Labels and Prefix Field Names.
One clone is a single one, then there is a repeater containing another clone. I’m assuming you can use a clone in a repeater (pretty sure I’ve seen that in the documentation)?
Also, I’m using other clones throughout the website, but don’t seem to notice any issues like this, so that’s why I was wondering whether this error is unique to it being on the Options Page? (and some ‘mixed up’ errors in the Options Page relate to non-cloned items, too)
Can you supply an export of the field group?
I don’t know, there was an issue with clone fields over on github here https://github.com/AdvancedCustomFields/acf-pro/issues/948#issuecomment-757618559.
You might want t contact the developer https://www.advancedcustomfields.com/contact/
You must be logged in to reply to this topic.
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!