Site icon Hip-Hop Website Design and Development

The best way to filter my search in put up if comprises a phrase in title, content material or excerpt?

I am attempting to filter one search, and I am involved in know if a phrase is contained in the title, the content material or the excerpt however with out luck and at last I am stucked.

$args = array(
            'post_type' => 'put up',
            'posts_per_page' => '-1',
            'search_prod_title' => $_POST['wordToSearch'],
            'post_status' => 'publish',
            'orderby'     => 'title',
            'order'       => 'ASC'
        );

    add_filter( 'posts_where', 'title_filter', 10, 2 );
    add_filter( 'posts_where', 'content_filter', 10, 2 );
    add_filter( 'posts_where', 'excerpt_filter', 10, 2 );
    $posts = new WP_Query($args);
    remove_filter( 'posts_where', 'title_filter', 10, 2 );
    remove_filter( 'posts_where', 'content_filter', 10, 2 );
    remove_filter( 'posts_where', 'excerpt_filter', 10, 2 );

And my filter capabilities are these ones:

    operate title_filter( $the place, &$wp_query )
    {
        world $wpdb;
        if ( $search_term = $wp_query->get( 'search_prod_title' ) ) {
            $the place .= ' AND ' . $wpdb->posts . '.post_title LIKE '%' . esc_sql( like_escape( $search_term ) ) . '%'';
        }
        return $the place;
    }

    operate content_filter( $the place, &$wp_query )
    {
        world $wpdb;
        if ( $search_term = $wp_query->get( 'search_prod_content' ) ) {
            $the place .= ' AND ' . $wpdb->posts . '.post_content LIKE '%' . esc_sql( like_escape( $search_term ) ) . '%'';
        }
        return $the place;
    }

    operate excerpt_filter( $the place, &$wp_query )
    {
        world $wpdb;
        if ( $search_term = $wp_query->get( 'search_prod_excerpt' ) ) {
            $the place .= ' AND ' . $wpdb->posts . '.post_excerpt LIKE '%' . esc_sql( like_escape( $search_term ) ) . '%'';
        }
        return $the place;
    }

The purpose is, the primary filter operate is working correctly, so I can search by title and the outcomes are good, however the outcomes for the remainder of the filters are unsuitable or not working.