Skip to content

Instantly share code, notes, and snippets.

@lswilson
Created June 6, 2013 01:26
Show Gist options
  • Save lswilson/5718671 to your computer and use it in GitHub Desktop.
Save lswilson/5718671 to your computer and use it in GitHub Desktop.
if ( ! function_exists( 'threatpost_get_attachment_id_from_src' ) ) {
function threatpost_get_attachment_id_from_src( $image_src ) {
global $wpdb;
$id = $wpdb->get_var( "SELECT ID FROM {$wpdb->posts} WHERE guid='$image_src'" );
return $id;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment