Make WordPress Core

Opened 9 months ago

Closed 9 months ago

Last modified 8 months ago

#50722 closed enhancement (fixed)

Change params on wp_image_file_matches_image_meta function

Reported by: spacedmonkey Owned by: SergeyBiryukov
Milestone: 5.5 Priority: normal
Severity: normal Version: 5.5
Component: Media Keywords: has-patch has-unit-tests
Focuses: rest-api Cc:


Change params on wp_image_file_matches_image_meta function for better reusability and more context to the filter.

Change History (6)

This ticket was mentioned in PR #423 on WordPress/wordpress-develop by spacedmonkey.

9 months ago

  • Keywords has-unit-tests added

#2 @SergeyBiryukov
9 months ago

  • Milestone changed from Awaiting Review to 5.5

#3 @spacedmonkey
9 months ago

The filter wp_image_file_matches_image_meta being passed the $attachment_id is important for plugins like jetpack that have custom image urls.

#4 @SergeyBiryukov
9 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to reviewing

If the goal is to provide pass the $attachment_id parameter to the wp_image_file_matches_image_meta filter, it seems like the best way forward would be to pass it along with $image_meta to the function.

That would be consistent with a few existing functions:

  • wp_calculate_image_srcset()
  • wp_calculate_image_sizes()
  • wp_image_add_srcset_and_sizes()

#5 @SergeyBiryukov
9 months ago

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

In 48547:

Media: Pass the attachment ID to the wp_image_file_matches_image_meta filter.

Props spacedmonkey.
Fixes #50722.

Note: See TracTickets for help on using tickets.