<?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 );
}
?>