Custom Customizer Image Sanitize fails to update image In Customizer
-
I use this custom sanitizer to get the appropriate image size so that anyone using my themes can’t mess up and put an 8k image in the website. The code works, but the problem I have is that once the code sanitizes the image and returns to the customizer the image doesn’t update… the old image just stays displayed and is got a shade of grey over it. What am I missing? If I switch the sanitize function below to say “esc_url” the images work just fine.
function semperfi_sanitize_image( $input , $setting ) { $postid = attachment_url_to_postid( $input ); if ( $postid != 0 ) return esc_url( wp_get_attachment_image_src( $postid , $setting->manager->get_control( $setting->id )->input_attrs[img_size] )[0] ); else return esc_url( $setting->default ); }
- This topic was modified 5 years, 10 months ago by .
- This topic was modified 5 years, 10 months ago by .
The page I need help with: [log in to see the link]
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘Custom Customizer Image Sanitize fails to update image In Customizer’ is closed to new replies.