mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2025-10-16 12:05:38 +00:00
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. git-svn-id: https://develop.svn.wordpress.org/trunk@53885 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
299c8485c0
commit
c2e2e55b0d
@ -3038,6 +3038,7 @@ function wp_ajax_query_attachments() {
|
||||
*/
|
||||
$query = apply_filters( 'ajax_query_attachments_args', $query );
|
||||
$attachments_query = new WP_Query( $query );
|
||||
update_post_parent_caches( $attachments_query->posts );
|
||||
|
||||
$posts = array_map( 'wp_prepare_attachment_for_js', $attachments_query->posts );
|
||||
$posts = array_filter( $posts );
|
||||
|
||||
Loading…
Reference in New Issue
Block a user