Exclude html from search results (image names, etc.)?

One possibility would be to try and alter the search SQL query. There’s a filter for that.

$search = apply_filters_ref_array( 'posts_search', array( $search, &$this ) );

and (sidenote) a filter to influence the ORDER BY clause as well

$search_orderby = apply_filters( 'posts_search_orderby', $search_orderby, $this );

I haven’t taken a look at search for quite some time, but when I look at WP_Query::parse_search, I could find something that might be of interest and worth giving a try.

  1. Look at

    protected function parse_search( &$q ) {
    

    which has the full stack of Query variables in it, so everything added actually lands inside that function. And in there is the following line:

    $n = ! empty( $q['exact'] ) ? '' : '%';
    

    If $q['exact'] is emtpy, then $n will be empty as well. This is what happens next:

    if ( $n )
        $q['search_orderby_title'][] = "$wpdb->posts.post_title LIKE '%$term%'";
    

    and

    $search .= "{$searchand}(($wpdb->posts.post_title LIKE '{$n}{$term}{$n}') OR ($wpdb->posts.post_content LIKE '{$n}{$term}{$n}'))";
    

    So if you have a query var(?) named exact which needs to be TRUE, you should be able to just run exact matches instead of the default LIKE clause followed by every match that is in the middle of anything.

  2. And as it’s protected, it may get overridden by an extending class. So you could just go and create class My_Search_Query extends WP_Query and define your own internals to generate the needed SQL statement.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)