Make WordPress Core


Ignore:
Timestamp:
10/05/2016 07:50:02 PM (8 years ago)
Author:
joemcgill
Message:

Media: Better handling of JOINs when searching filenames.

Following [38625], any media searches that already included JOINs,
e.g., tax_queries, would get trampled when we joined the post meta
table to search for filenames. This preserves existing JOINs and
also only applies the _filter_query_attachment_filenames() filter
when a search query is being performed.

Props flixos90, joemcgill.
Fixes #22744.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/ajax-actions.php

    r38710 r38733  
    24022402
    24032403    // Filter query clauses to include filenames.
    2404     add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
     2404    if ( isset( $query['s'] ) ) {
     2405        add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
     2406    }
    24052407
    24062408    /**
Note: See TracChangeset for help on using the changeset viewer.