WordPress Metadata Media Naming

A client of mine recently ran into a problem. He had a large number of professionally shot photography for his business. Over the years he had gotten into the good habit of renaming his photos so they were easy to manage. The problem was that WordPress’ media manager was naming the photos using metadata that had been attached to the images by the DSLR that shot them. In his case all images where being called ‘SONY DCR’. I essentially needed to remove the metadata title when the image was uploaded so WP wouldn’t use it as the title. After some searching I found exactly what I needed in wp_read_image_metadata.

add_filter( 'wp_read_image_metadata', 'custom_upload_name' );  

function custom_upload_name( $file )
{
    $file['title'] = "";

    return $file;
}

Pretty simple solution, but it works nicely. Just add this to your functions.php file.


Posted

in

,

by

Tags: