search – How make Autocomplete with wp_query in post_type attachment

Question

This is my list of arguments to search for the attached files and I need to make it take references, for example, if my file is called banner, when placing the letter b, said file and others that may contain this same letter appear without having to place everything. the name I can not find the solution

    if (isset($_GET['search']) && !empty($_GET['search'])) {
        $value = $_GET['search'];
    }
    
    if (isset($_GET['select']) && !empty($_GET['select'])) {
        $check = $_GET['select'];
    }

$query_images_args = array(
            's' => $value,
            'post_type' => 'attachment', 
            'post_status' => 'inherit',
            'orderby' => 'date', 
            'order' => 'DESC',
            'post_mime_type' => $check,
            'posts_per_page' => '-1'
        ); 

        $query_images = new WP_Query(  $query_images_args  );

0
Moises Garcia 2 weeks 2022-11-16T10:45:04-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse