Couple points:
-
The
customize_register
action hook actually passes your function the$wp_customize
variable, you don’t need to declare it as the global. Just put it as the first argument in your function declaration. -
The reason your code doesn’t run on the front end of the site is that the
customize_register
action hook only runs when the customizer is being used. If you want to declare data somewhere that it will always be available, don’t put it in a function hooked tocustomize_register
.
Related Posts:
- Need help setting default setting value for radio button in theme customizer
- Is having multiple theme customizers for different pages possible?
- How to export/import theme customizer settings?
- Remove Customize Background and Header from Appearance admin menu without CSS or JS
- Is it possible to get a theme customizer setting from wp.customize using jquery?
- reason of splitting theme files to multiple files
- Dynamically change feature image in customiser
- One button to change all settings in theme customizer?
- Design view breaking on Pages
- Dynamically loaded Theme components based on Customizer Settings values : changes not appearing in Customizer preview – (Workaround found)
- Show different Customizer Settings on Page-Tamplates
- How to get custom image size for image uploaded in Customizer
- Passing array in add_option()
- Displaying theme options in css
- max_input_vars: how many am I using?
- Set WordPress Default Template
- Using a variable in is_page(array())
- How do I get current page ID in WordPress customizer file?
- Set the checkbox as checked by default at options page
- Customizer – Prefix Class Extension
- Theme Options Page – User Updates Logo
- get_the_tags() not iterating through for/while loop, but will with foreach
- Customizer: active_callback and sanitize_callback incompatibility?
- Skt full width basic slideshow problem
- WordPress Customizer Default Image
- Getting posts to exclude from array
- Get all posts as an array ID => Name
- Get css class of menu item in custom menu structure
- Need advice on theme customizer and child themes
- How to make sure relative URL works when site is not on root domain?
- Getting text from custom field from customizer
- Dynamically switch file in get_template_directory_uri() | Function [closed]
- Illegal string offset in PHP function in via Theme Customizer
- require get_template_directory() . ‘path/to-my/file.php’ BREAKS customize > themes functionality
- Change CSS Variable value in Theme Customizer Live Preview
- Customizer: How to Sanitize a Decimal Number Range
- make an array in wordpress cusmization api?
- Use Custiomizer to setup meta theme color tag
- How to replace hard-coded list of custom taxonomy terms based on custom field query [closed]
- Create Customization Controls from Array
- How to add button to top of theme customizer?
- Not able to call class in NHP framework
- How to store the_post_thumbnail() value in a variable
- How to determine if WP_DEBUG is enabled? [duplicate]
- WordPress Customizer: How can you have multiple active callbacks on one control?
- How to use copy() function and paste file in /wp-content/themes directory
- How to add default images into theme customizer image control?
- Using a javascript file to access a get posts array
- How can one utilize a variable as a callback function name for add_settings_field
- I think emoji are killing my WordPress site… How can I debug?
- Generate an array of parent/child page IDs, based on parent page name
- How do I output a database option that is an array into a get_posts array?
- Custom Logo URL | Help me print the URL of the custom logo I inserted into my theme
- Customizer Show/Hide
- Why is this Ajax not working?
- How do themes render caption texts in extended markup (e.g. “wp-caption” paragraphs)
- How to load a template-part based on a url wildcard?
- Multiple WordPress Menus that will only display all pages
- Custom theme: Alternatives to long list of ‘include’ in functions.php
- Storing Array from returned database query and using the array in a new query
- How to show part of the_content?
- Hide categories that are not used in the post type
- Exclude posts based on meta value
- Is there a way to conditionally check whether a WordPress post title is empty?
- Advanced Custom Fields – display label and value only if value entered
- Use WordPress function in php file
- wp_force_remove_style’ not found
- How can I access string value in an array?
- Filtering a function’ output for a new continued function
- Why in my theme I can’t see all the statics content under the posts?
- How to say if meta_value is greater than 0 in an array?
- Extending WP_Customize_Media_Control to return filename
- How to make function appear in sentence?
- Widgets not showing on custom theme
- How to modify mobile nav menu text in theme
- Separate array output into a
- Use SCSSPHP to compile Theme Customizer Values into .SCSS files ready to compile to CSS
- How to get my [shortcode] rendered on the home page, other pages are fine
- Php file that doesn’t recognize wordpress functions
- Using php inside javascript [closed]
- Update value of a associative array with update_post_meta
- Why in this WordPress theme I can’t see the Main Menu?
- Ajax URLs without #!, how to prevent falling into single.php on load or reload?
- Get options from database using php class
- MySQL Query Returns Array () In Shortcode
- WordPress single.php get_header not working
- Unable to retrieve get_author_posts_url
- Store user form submitted information in post type
- WordPress files break if I edit them, but adding a closing PHP tag fixes it
- How can i iterate through this shortcode array?
- Not able to get the exact URL of the file on server located in active wordpress theme
- Using Customizer value in an external PHP file inside a theme
- Extend the WP_Customize_Image_Control class to change its non-frame $button_labels
- need help to arabic text in wordpress
- Category List in Theme Options Page
- Showing all post from all post type in admin backstage
- Using is home to get content [closed]
- How I can give a php page a style from my theme
- Add default block css when the block has been added with php?
- How to initialise WP_Query on the basis of a specific meta_value and continue iterating rest?