I am not 100% sure I understand what you want but... WordPress treats attached media like a custom post type. The file name, minus the extension, is stored as the `post_title` in the `$wpdb->posts` table. So, to get the path just search for the file name minus the extension. $q = new WP_Query( array( 'fields' => 'ids', 'post_title'=>'1011722_472449312832633_575764530_n', 'post_type' =>'attachment', 'post_status' => 'inherit', 'ignore_sticky_posts' => true, 'posts_per_page' => 1 ) ); $attid = $q->posts[0]; You can use `$attid` plus [`get_attached_file`][1] or [`wp_get_attachment_image`][2] or other attachment function to the other information you want. [1]: http://codex.wordpress.org/Function_Reference/get_attached_file [2]: http://codex.wordpress.org/Function_Reference/wp_get_attachment_image