1

I'm using the WP_Customize_Image_Control function to allow users to upload an image. Once they've uploaded it, I don't want them to remove the image, only to change it. This is what I want (look ma, no remove button):

enter image description here

How can I hide or remove the remove button?

2

The easiest way is to just hide it with CSS. For example:

#customize-control-custom_logo .button.remove-button {
    display: none;
}

The harder way would be to subclass the image control JS and omit the remove button from the template, but this seems overkill.

  • Thanks! Yes, the CSS option crossed my mind, but it seemed a little hacky, so thought there might be an official way, like a filter or through the $args parameter. I agree that subclassing the image control is way overkill. – Lea Cohen Jul 18 '17 at 5:14

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.