mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-23 01:27:36 +01: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. Built from https://develop.svn.wordpress.org/trunk@53885 git-svn-id: http://core.svn.wordpress.org/trunk@53444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
d7f5fe1283
commit
0161ef8f72
@ -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 );
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.1-alpha-53884';
|
||||
$wp_version = '6.1-alpha-53885';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user