1

I've registered a custom setting type to set a site_option rather than option or theme_mod.

I've written the appropriate action hooks to make these values save and preview properly, and can easily get them in my theme with get_site_option.

However, I feel I am missing something obvious, because my controls cannot fetch these values. Every time I open the customizer, the defaults are back.

It seems like since there is a customize_update_{$setting_type} action, there should be a customize_get_{$setting_type} action as well, but there isn't.

The docs seem to only cover saving and previewing custom setting types, nothing about getting their values.

How is this supposed to work?

1 Answer 1

1

So far the only solution I've been able to discover is to write individual customize_value_{$setting_id} filters for each and every setting I add. I hope someone knows of a better way.

1
  • There is a Trac ticket (with several duplicates) for this that pre-dates your question. The last action was a year ago, marking it low priority. Perhaps you should make a comment on it, or submit a patch. core.trac.wordpress.org/ticket/29316 Although, the more I look at your question, the more I think you just need to make sure you supplied a render_content function and a json function, so that the control has what it needs. Commented Mar 20, 2018 at 1:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.