Make WordPress Core

Changeset 53885


Ignore:
Timestamp:
08/12/2022 12:15:20 AM (2 years ago)
Author:
peterwilsoncc
Message:

Media: Cache parent posts in query-attachments AJAX endpoint.

Prime the parent post objects wp_ajax_query_attachments() to reduce the number of database queries in the query-attachments admin-ajax endpoint.

Props albatross10.
Fixes #56037.

File:
1 edited

Legend:

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

    r53801 r53885  
    30393039    $query             = apply_filters( 'ajax_query_attachments_args', $query );
    30403040    $attachments_query = new WP_Query( $query );
     3041    update_post_parent_caches( $attachments_query->posts );
    30413042
    30423043    $posts       = array_map( 'wp_prepare_attachment_for_js', $attachments_query->posts );
Note: See TracChangeset for help on using the changeset viewer.