Make WordPress Core


Ignore:
Timestamp:
09/20/2016 01:44:07 AM (8 years ago)
Author:
joemcgill
Message:

Media: Make media library searchable by filename.

This applies a new private function, _filter_query_attachment_filenames(),
to the post_clauses filter hook during wp_ajax_query_attachments() and
wp_edit_attachments_query_vars() to include _wp_attached_file post meta
in search queries performed from the media library or in a WP_Media_List_Table.

Props wonderboymusic, DrewAPicture, joemcgill, swissspidy.
Fixes #22744.

File:
1 edited

Legend:

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

    r38490 r38625  
    23982398        $query['post_status'] .= ',private';
    23992399
     2400    // Filter query clauses to include filenames.
     2401    add_filter( 'posts_clauses', '_filter_query_attachment_filenames' );
     2402
    24002403    /**
    24012404     * Filters the arguments passed to WP_Query during an Ajax
Note: See TracChangeset for help on using the changeset viewer.