Support » Plugin: Enable Media Replace » Feature Request: Add Query String for Cache Busting

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author ShortPixel

    (@shortpixel)

    Hey @heyjoecampbell – thanks for taking the time to suggest us this feature.

    We’ll consider it for a future update but we’re not yet sure the amount of work this would involve vs. the benefits.

    Regards,
    Alex

    Thread Starter heyjoecampbell

    (@heyjoecampbell)

    I understand – In the meantime, I have modified a function snippet to append a timestamp to all uploaded media:

    function append_media_timestamp($filename) {
    	
    	$timestamp = date("YmdGs");
    	$append = apply_filters('usp_file_append_random', true, $filename, $random);
    	
    	if (!$append) return $filename;
    	
    	$info = pathinfo($filename);
    	$ext  = (isset($info['extension']) && !empty($info['extension'])) ? '.'. $info['extension'] : '';
    	$name = basename($filename, $ext) .'-'. $timestamp;
    	
    	return $name . $ext;
    	
    }
    add_filter('sanitize_file_name', 'append_media_timestamp', 10);

    Question: how do I auto select the following parameter:

    Replace the file, use new file name and update all links

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Feature Request: Add Query String for Cache Busting’ is closed to new replies.