WordPress.org

Make WordPress Core

Ticket #17021: find-posts_3.2.patch

File find-posts_3.2.patch, 951 bytes (added by kevinB, 7 years ago)

query filter for ajax Find Posts

  • wp-admin/admin-ajax.php

     
    12741274        if ( count($search_terms) > 1 && $search_terms[0] != $s )
    12751275                $search .= " OR ($wpdb->posts.post_title LIKE '%{$term}%') OR ($wpdb->posts.post_content LIKE '%{$term}%')";
    12761276
    1277         $posts = $wpdb->get_results( "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50" );
     1277        $posts = $wpdb->get_results( apply_filters( 'find_posts_query', "SELECT ID, post_title, post_status, post_date FROM $wpdb->posts WHERE post_type = '$what' AND post_status IN ('draft', 'publish') AND ($search) ORDER BY post_date_gmt DESC LIMIT 50", $what, $search, $s ) );
    12781278
    12791279        if ( ! $posts ) {
    12801280                $posttype = get_post_type_object($what);