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
- Capture the Selected Radio Button Value between two files in wordpress theme
- WordPress Customizer – How to save list of checkbox of pages?
- How do I create a single.php file as the default template for single posts in the twentytwentythree theme?
- Show the terms of the hierarchical taxonomy
- Populate dropdown with Child Pages based on Parent Page chosen
- Create a range slider to change font-size with different screens sizes in wordpress customizer api
- How do I add custom bulk actions to multiple custom post types?
- Add_action not working in required file of functions.php
- How to use $query->set with post__in?
- How to set up VS Code for WP plugin/theme development in 2021? [closed]
- adding custom user input fields in WordPress admin dashboard gives error The link you followed has expired. Please try again
- what is the best practice to add new field to an api route
- WP Post-Thumbnail
- Grab posts by multiple categories
- Can’t access variable outside for loop
- I have a problem in the order of enqueues while enqueuing stylesheets and scripts for a specific page in my function.php
- add custom link to wordpress media gallery modal
- Reprinting tags with all attributes
- Need Help Fixing My Iframes [closed]
- Avoid parallax images hardcoding
- Improve page speed loading using CDN and async or defer attribute
- PHP Array Returning [object Object]. Tried existing answers results with no luck
- foreach loop still echoes array
- populate form fields in a loop with ajax
- Error in custom php function doesn’t exist
- post created but no permalink
- Return a numerical function value in Customizer controls
- Customizer: Multiple CSS styles on same element in Live Preview
- How can I make my options in an array and store theme in WP options one DB row?
- Exclude posts based on meta value
- Populate editor with some content of a page with a page template
- Customizer: Category Select Sanitize
- Two queries for a WP_User_Query search work perfectly apart, but not together
- Recent Posts Not Showing Only On A Specific Category Page [closed]
- Catchable fatal error: Object of class stdClass could not be converted to string after WP 4.7
- Menu jumping when calling it via PHP
- Problem custom control Customizer
- Displaying recent posts on static page with template-part via shortcode
- How to edit widget code to add unique class name to each div?
- Checking array against author id in loop
- How to disable wordpress from overload my stylesheet styles with customizer styles
- Compare the old get_theme_mod($name) to the new get_theme_mod($name) return value
- How to enqueue javascript for WP Customize options sidebar?
- How to disable controls in theme customizer?
- How do I link a button I created in theme customizer to a function?
- Trying to retrieve post meta
- Error: options page not found
- can i fetch a custom metabox data in another page or post type?
- Is there a way to conditionally check whether a WordPress post title is empty?
- WordPress theme options error
- Is the “_s” on this `sprintf(__(‘Page %s’, ‘_s’), max($paged, $page))` just refer to a text domain?
- Redirect to another page using contact form 7? [closed]
- get_template_part for specific page
- How do I create my own .php file with a code part and echo it on different pages?
- Alter required message using comment form api
- How to remove woocommerce_breadcrumb() from do_action( ‘woocommerce_before_main_content’ ); [closed]
- ‘Post-thumbnails’ feature does not seem to register