Created
January 1, 2018 18:11
-
-
Save trey8611/af5bd35d1550438e97ac14750e20c22d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function my_search_media_library( $image ) { | |
global $wpdb; | |
$all_images = array(); | |
$query = "SELECT * FROM " . $wpdb->posts . " WHERE guid LIKE '%" . $image . "%'"; | |
$results = $wpdb->get_results( $query ); | |
if ( $results ) { | |
foreach ( $results as $result ) { | |
$all_images[] = basename( $result->guid ); | |
} | |
} | |
return implode( ",", $all_images ); | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment