Make WordPress Core

Opened 2 years ago

Closed 22 months ago

Last modified 20 months ago

#56037 closed enhancement (fixed)

Call update_post_parent_caches in wp_ajax_query_attachments function

Reported by: spacedmonkey's profile spacedmonkey Owned by: peterwilsoncc's profile peterwilsoncc
Milestone: 6.1 Priority: normal
Severity: normal Version:
Component: Media Keywords: good-first-bug has-patch needs-dev-note
Focuses: performance Cc:

Description

Call update_post_parent_caches in wp_ajax_query_attachments function to prime parent caches in a single request.

Change History (14)

#1 @hellofromTonya
2 years ago

  • Milestone 6.1 deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Duplicate of #56036.

#2 @spacedmonkey
23 months ago

  • Resolution duplicate deleted
  • Status changed from closed to reopened

@hellofromTonya This is not a duplicate.

#3 @desrosj
23 months ago

  • Milestone set to 6.1

Re-adding a milestone.

#4 follow-up: @albatross10
22 months ago

Hello.

This is my first-time Contribution to WordPress. Can I get more information on where exactly we want to place the function?

Thank You

#5 in reply to: ↑ 4 @spacedmonkey
22 months ago

Replying to albatross10:

Hello.

This is my first-time Contribution to WordPress. Can I get more information on where exactly we want to place the function?

Thank You

The function in question can be found in wp-admin/includes/ajax-actions.php file. update_post_parent_caches Expects an array on post objects. So pass the array posts into the function after line 3014.

This ticket was mentioned in PR #3069 on WordPress/wordpress-develop by bhavz-10.


22 months ago
#6

  • Keywords has-patch added; needs-patch removed

Call update_post_parent_caches in wp_ajax_query_attachments function to prime parent caches in a single request.

Trac ticket: https://core.trac.wordpress.org/ticket/56037

#7 @albatross10
22 months ago

Hello @spacedmonkey

I have added a patch and a PR. I would be glad to work on any changes suggested.

Thank You

#8 @spacedmonkey
22 months ago

@albatross10 I have provided a review.

#9 @albatross10
22 months ago

@spacedmonkey
I have updated the PR as per your feedback.
Apologies since this is my first contribution.

#10 @albatross10
22 months ago

Hello @spacedmonkey

I made the recent changes in the PR as suggested by @peterwilsoncc

Thank You

#11 @peterwilsoncc
22 months ago

  • Owner set to peterwilsoncc
  • Resolution set to fixed
  • Status changed from reopened to closed

In 53885:

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.

bhavz-10 commented on PR #3069:


22 months ago
#13

Thanks @peterwilsoncc and @spacedmonkey
This was my first contribution and you guys made it smooth

#14 @desrosj
20 months ago

  • Keywords needs-dev-note added

There are a lot of caching related changes in 6.1 and a dev note should be written collecting them all. Marking this for inclusion.

Note: See TracTickets for help on using tickets.