Last active
December 7, 2022 04:48
-
-
Save ajskelton/2ed4017fa0842bae49b99888daa998b3 to your computer and use it in GitHub Desktop.
Add a Radio field to the WordPress Customizer.
Thanks, this is a very nice working example. And with custom values!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The only error in the code was the wrong name for the function that does the sanitizing. The first comment here mentioned it was called
_sanitize_radio
and I only corrected it in the first instance.To see a full example of using the code you can see my blog post on using all the customizer settings, https://anthonyskelton.com/2016/rediscover-wordpress-customizer/. However it is four years old so I can't speak to how current all of the information is.
I did a quick test with the above code ( with the correct name on the sanitize function ) and it worked no problem for me on a fresh twenty_twenty child theme. Here is the code I used for that test that includes adding a panel and section and hooking it all to the
customize_register
action.