Make WordPress Core

Opened 3 years ago

Closed 2 years ago

Last modified 2 years ago

#56036 closed enhancement (fixed)

Call update_post_parent_caches in WP_Media_List_Table

Reported by: spacedmonkey's profile spacedmonkey Owned by: antpb's profile antpb
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_Media_List_Table to prime parent caches in a single request.

Change History (10)

#1 @spacedmonkey
3 years ago

  • Focuses performance added

#2 @hellofromTonya
3 years ago

#56037 was marked as a duplicate.

#3 @jeawhanlee
2 years ago

Hi,
I'm new here so I was wondering where in the WP_Media_List_Table class do I call the update_post_parent_caches function.

This ticket was mentioned in Slack in #core-media by antpb. View the logs.


2 years ago

#5 @antpb
2 years ago

  • Owner set to antpb
  • Status changed from new to assigned

Assigning myself to investigate this one.

#6 @peterwilsoncc
2 years ago

Hi @jeawhanlee and welcome!

In the file src/wp-admin/includes/class-wp-media-list-table.php the call need to be added within the prepare_items() method.

At the end of the prepare_items() the media objects are available in the variable $wp_query->posts which can be passed to the update_post_parent_caches() function.

Most contributors use GitHub to submit patches these days, you can find the instructions for doing so in the handbook.

This ticket was mentioned in PR #3107 on WordPress/wordpress-develop by alaca.


2 years ago
#7

  • Keywords has-patch added; needs-patch removed

Call update_post_parent_caches in WP_Media_List_Table to prime parent caches in a single request.

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

#8 @alaca
2 years ago

@peterwilsoncc, @spacedmonkey this is ready for review.

#9 @spacedmonkey
2 years ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 54098:

Media: Call update_post_parent_caches function in WP_Media_List_Table class.

Call the update_post_parent_caches in WP_Media_List_Table class to prime parent caches in a single database request.

Props spacedmonkey, antpb, hellofromTonya, jeawhanlee, peterwilsoncc, alaca.
Fixes #56036.

#10 @desrosj
2 years 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.