Custompress, No way to remove image after selecting it

I have Custompress installed and using an Image Upload field. I can add an image just fine. But there's no way to remove the image afterward?? The only button available it Upload. After clicking the button, I can't even uncheck the current image, only replace it with a new image. So now I'm stuck with an image for a cpt when there should be no image at all. How do I add a Remove Image button??

  • Luís
    • Support

    Hi @jarelsc,

    Hope you're doing well today!

    I think a remove button would be a great feature, so I've just moved this over to our Features and Feedback, so it can be taken into consideration for the next plugin updates.

    Hopefully some other members will show their support for the feature too, the more members that ask for it the sooner it will happen.

    However, I flagged the SLS team (our code experts :slight_smile: ) to get their valuable feedback.

    Since this team deals with more advanced threads it may take them longer to reply.

    Cheers, Luís

  • Jarel
    • Site Builder, Child of Zeus

    Well that's really disappointing to hear. It makes Custompress Image Uploads completely unusable. So if my client accidentally added an image to the wrong field, or chose an image by mistake, there's no way to remove it without deleting the entire post and starting over again. That's a huge pain.

    In a basic programming class the fundamentals are Read, Write, Edit, Delete. This should *not* be a feature request. This should have been available since its very first release. The fact that this was overlooked is ridiculous.

    For the last year and a half I've been struggling with multiple wpmudev plugins because of small things like this that I've had to fix myself. This is why I've been moving away from using wpmudev plugins, and cancelled my membership.

    *** But for those of you reading this who have this issue too, this is what I did to fix it. Its not the most elegant, but works fine for the two upload fields I required.

    1. Admin enqueue a .js file in your theme so you have a custom .js file that loads in your wordpress admin. Use the admin_enqueue_scripts hook. This can go in your themes functions.php

    add_action('admin_enqueue_scripts', 'fix_custompress_uploads');
    function fix_custompress_uploads() {
        $template = get_stylesheet_directory_uri();
        wp_enqueue_script( 'fix-custompress', $template . '/custom/js/fix-custompress.js' );

    2. Inside this .js file add this code below. Note wordpress admin runs in no-conflict mode so I'm using "jQuery" instead of the "$". I found these IDs I used below by using Chrome's developer tools. Above the Upload button you will see a hidden input field. This input field has the ID I used below. Find the IDs your site uses and change accordingly.
    Example with 2 Remove buttons for 2 image upload fields:

    	jQuery('#ct_Product_Im_upload_e1ff').after('<button id="remove-ct_Product_Im_upload_e1ff" type="button" class="button" style="margin-left: 10px;">Remove</button>');
    	jQuery('#ct_Featured_I_upload_5c9f').after('<button id="remove-ct_Featured_I_upload_5c9f" type="button" class="button" style="margin-left: 10px;">Remove</button>');
    	jQuery('#remove-ct_Product_Im_upload_e1ff').on('click', function(){
    		return false;
    	jQuery('#remove-ct_Featured_I_upload_5c9f').on('click', function(){
    		return false;

    So basically, this code above appends a "Remove" button after that hidden input field which holds the image ID for that field. Then the "click" function just removes the value from that hidden input field and removes the image that Custompress adds as a visual.
    Hope this helps anyone reading.

    It's not rocket science wpmudev.

  • Luís
    • Support

    Hi @jarelsc,

    Hope you're doing well today!

    I understand the the lack of a remove button turns the feature incomplete, I am sure our developers are aware and working to fix it in a next update.

    However, I am glad you have solved your issue and thanks for sharing the code with the community.

    Cheers, Luís

  • Milan
    • WordPress Wizard

    Hello @jarelsc,

    I am marking this thread as reasolved as your requirement of addign remove button is completed. Please note that you don't need to reply us back here now onwareds. If you think solution is not working and you face issue with give solution, please feel free to ping us back.

    Enjoy WPMU DEV.
    Best Regards,

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.