It’s always a good idea to sanitize values being accepted from the user. A WP_Customize_Cropped_Image_Control
will populate its associated setting with an attachment ID. Thus you could use absint
as the sanitizing function.
Remember that esc_attr
is an escaping function and should only be used when printing out a value to the page, and here particularly in an HTML attribute. Note also that esc_url_raw()
is not an escaping function, despite its name, but rather is actually a sanitizing function.
Related Posts:
- Where is Customizer related data stored is the database?
- Adjust the Device Preview sizes used in the WP 4.5 Customizer
- WP Customizer – Prevent live preview
- Different customizer previewUrls per section
- Theme customizer – possible to disable Live Preview?
- Theme Customization API options on install
- Passing data from customize-controls.js to the customize-preview.js
- Get attachment id from WP Customizer
- Why does get_theme_mod return blank (or default value) but get_option returns saved value?
- Get current post ID of customizer preview window
- Deactivate sections/panels when the Customizer finishes loading
- Add button to Customizer
- Why is remove_setting and remove_control not working?
- Need to run a plugin on Customize.php
- Customizer preview doesn’t update get_option() value properly
- Customizer Issue, Default Settings not working
- WP customizer + gulp + browsersync = refused to display in iframe?
- Set Default Page On Customizer Live Preview
- Rename and rearrange customizer section
- Theme Customizer Custom Background / Header Image
- get_theme_mod not working
- Customizer not saving image settings
- How to hide few theme customization options – TwentySeventeen theme
- Theme Customizer – My panel disappears
- How to remove mixed content warnings in WP Customizer
- Does the customizer support multiple templates?
- Theme Customizer changes are dissappearing when change page
- How can a default site icon be set in customizer?
- New customizer setting not showing value
- Customizer Selective Refresh doesn’t refresh properly with saved value
- Removing pre existing menu item
- Theme customization based on grouped pages
- Issue with Customizer: only last field shown in section
- get_theme_mod() only working when the customizer is open
- Change the location of add_theme_support( ‘custom-header’ ) in the customizer
- add_theme_support(‘custom-header’) does not add the option to customize
- Create custom control for WordPress customizer using JavaScript
- Customizer Not Applying Any Change, No Error Thrown
- Custom panel/section link styling in customizer
- Theme Customizer – Text without a setting (a comment or tag)
- Translations appear in the WP Customizer, but not on the website!
- How To Remove or Hide Appearance->Background from Admin Menu
- Custom switch not hiding sub-fields on Customizer’s load
- WordPress Customizer Selective Refresh: works only on first setting change
- How to use WP_Customize_Cropped_Image_Control settings in the customizer preview?
- WordPress Customizer: Why widgets and nav_menus are components, not panel or section?
- Add customiser controls directly to a panel
- How to use sanitize_callback?
- datepicker works on widgets options page, but not on customizer
- get_theme_mod Not Functioning Properly
- How to add width & height (resolution) on wordpress function?
- WordPress Customizer Panels in separate files
- Function has_custom_logo when used in Customizer
- theme customizer issue
- WordPress Include ‘print_f’ in WP_Customize_Control array [closed]
- doubble scroll bar on wordpress home page [closed]
- WordPress Customizer allow line break
- Hooks to watch customizer value change
- How to add UI buttons in customizer like twentyseventeen
- How do you add a link in the description of one section of the customizer to another section in a different panel?
- Get WordPress page Id inside customizer
- How to delete old custom-css-stuff in the customizer-live-preview?
- What is the id for the widgets section of the WordPress theme customizer?
- How to import and export settings from live customizer?
- Unexpected output using theme customizer
- Initialize WordPress customizer variables
- WordPress navigation URL became hashed URL automatically
- Twentyseventeen theme customize bug
- customizer refresh breaks with this code but I don’t understand why
- Is there a way to load translations from .PO and .MO files for Customizer strings?
- Customizer – binding jQuery created controls
- Image Uploaded To Customizer Not Displaying
- add a section in wordpress theme to upload image and process it
- Can I fake being in the customizer?
- Broken Customizer After Migration To The Skeleton Architecture
- In 2016 Theme where is the Posts page thumbnail image stored?
- I need to get the control choices to sanitize_callback
- Edit style.css via theme customizer
- Exiting Customizer alert
- How do I flush a conditioned control’s value if the parent control has been unchecked?
- input type=”button” not working in customizer
- Hide Customizer Setting on ‘ready’
- Manipulating customizer panels and fields?
- Location of customizer Menu panel core code
- How to add a Visual Edit Shortcut to a theme mod?
- Use the customiser to set the background-image of a div
- Return value of get_background_color
- Let user select file in customizer
- Customizer_register not saving custom setting to database
- WordPress Customizer Hides my Sections / Controls inside of is_admin()
- New Customizer Menu (WP 4.3) – how is called?
- Custom Sanitation Function Triggering an Alert in Customizer?
- How to tell theme customizer to save setting in my option table?
- How to work around case sensitivity of HEX values?
- WP Theme Customizer – Responsive Elements
- How to check WP Customize Control
- Custom logo manage by customizer and theme options
- How to rename and rearrange multiple sections in the Customizer?
- Issue displaying customiser setting with get_theme_mod
- How to add CSS to head by php through echo self::css();