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

    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 ) to get their valuable feedback.

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

    Cheers, Luís

    Jarel

    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
    Example:

    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(document).ready(function(){
    
    	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(){
    		jQuery('#ct_Product_Im_upload_e1ff').val('');
    		jQuery(this).siblings("img").remove();
    		return false;
    	});
    
    	jQuery('#remove-ct_Featured_I_upload_5c9f').on('click', function(){
    		jQuery('#ct_Featured_I_upload_5c9f').val('');
    		jQuery(this).siblings("img").remove();
    		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.