Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

The customize_register is hooked to wp_loaded which runs on the front end too, but when in the frontend I access the global wp_customize variable, it's empty. I'm wondering, does WordPress removes the registered settings and section when the site is viewed? Is there a way to access the registered options in the body_class hook for example?

share|improve this question
    
Can you add any relevant code please? –  s_ha_dum Jan 27 '13 at 21:12
add comment

1 Answer 1

Yes this right. The var is only for customize the theme and works not in frontend, overhead and not usefull. After the user customize the theme, than was saved in options. Use the default functions to get the data, like the function get_option().

See also this theme file as example. It add stylesheets in frontend and use the data from the customizer. But this class use a method from the parent class and tbis method use get_option() to get the data.

share|improve this answer
    
Hi, I don't want the value for the option, but the registered settings. I want to call the sanitization callback registered for the setting on the front end, but unfortunately there seems to be no way around it other than to create a wrapper for the customization API and let that wrapper do the work. It's an ugly solution, very repetitive and frankly, unnecessary. –  Hassan Jan 27 '13 at 22:22
    
What is the difference for the option and settings for you? The user save on the customizer the settings inside the options table, in a sanitized string. You get it as array and can use it. –  bueltge Jan 28 '13 at 11:54
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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