(Somehow I didn’t notice there was a new forum last week, and I managed to post this to the old one. Here’s what I had posted there.)
I have 2 options pages set up, and several field groups that appear on them.
I have set default values for most of the fields, but they do not appear. No radio buttons are selected, no text shows in the text fields, no numbers in the number fields, etc.
If I set those same field groups to appear on a write panel for any post type, the default values do appear. It’s only the Options pages that they aren’t working on.
Is anyone else experiencing this, and any ideas on how to fix it?
I’m not getting any errors, so I’m not sure what to try next.
(Also, is there a way to remove the “solved” status of a thread? I didn’t think I should create a separate post for this, since I’d already described the problem once before, but it is no longer “solved” for me.)
This is on a brand new site, immediately after the WordPress install. I just searched the database for one of the field names, but nothing was found.
I also have fallbacks in place for if a value doesn’t exist, and the theme is currently outputting those fallbacks.
I’m not sure why this is not working for you. I just created a new field called ‘Test New Field’ (text) and added it to the options page via the location rules.
This field had a default value of ‘Test default’
I opened the options page and the default value ‘Test default’ loaded into the input.
I then saved the field and it saved with the default value correctly.
Looking at my wp_options table, I noticed that the option_name is actually ‘options_test_new_field’, so the options page add-on saves with a prefix of ‘options_’.
Perhaps this explains why you could not find a value previously.
Looks like it’s working correctly for me, hope you can get it to work.
i do this with the colorpicker.
The default value has been stored in the database.
But if I clear or change the value the default value is ignored.
I wish that the default value is displayed as a color after I pressed on clear button.
Isn’t it possible?
A default value is only loaded when a value does NOT EXIST in the DB. What you have described is clearing the value, or selecting #fff. This is still a value and still EXISTS in the DB. THerefore the default value will not load.
The actually row in the DB must be completely removed from the DB for ACF to load in the default value.
If you require customization to this, please read the docs for the ‘acf/load_value’ filter
The topic ‘Default values not loading on Options page’ is closed to new replies.
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!