I have replaced the color input in the customizer with an input that supports the alpha channel. The sanitization function from WordPress is only for hex colors but I get rgba() colors. I wrote a sanitization function that works perfectly for any new control I add to the customizer but if I replace an existing one and change the sanitize_callback parameter of the corresponding setting to my own function (
$wp_customize->get_setting("background_color")->sanitize_callback = "slug_sanitize_color";) WordPress still uses its standard sanitize_hex_color. The output of
string(19) "slug_sanitize_color" so I guess it should work. If more code is needed I can provide it.
What do I have to do to make WordPress use my sanitization function for a preexisting control instead of the one WordPress ships with?