Get Original Filename from WordPress Image Names That Have Width and Height Added

Remove the sizes from the WordPress image filenames that have the width and height added to the original file name. For example, this takes the medium or thumbnail image name, such as “image-150×150.jpg”, and it will return the originally uploaded image filename, which in this example is “image.jpg”.

function isa_original_image_name($filename){
    return preg_match('/\-\d{2,4}x\d{2,4}\./', $filename, $matches) ? str_replace($matches[0], '.', $filename) : $filename;
}

Questions and Comments are Welcome

Your email address will not be published. All comments will be moderated.

Please wrap code in "code" bracket tags like this:

[code]

YOUR CODE HERE 

[/code]