WordPress.org

Make WordPress Core

Opened 6 months ago

Closed 6 months ago

#51866 closed defect (bug) (fixed)

metadata_exists does not pass the meta_type to the get_{$meta_type}_metadata filter

Reported by: jsmoriss Owned by: SergeyBiryukov
Milestone: 5.7 Priority: normal
Severity: normal Version: 5.5
Component: Options, Meta APIs Keywords: good-first-bug has-patch
Focuses: Cc:

Description

There's a 5th argument missing in this second "get_{$meta_type}_metadata" filter call:

$ grep -n '"get_{$meta_type}_metadata"' wordpress/wp-includes/meta.php
564:	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, $single, $meta_type );
676:	$check = apply_filters( "get_{$meta_type}_metadata", null, $object_id, $meta_key, true );

Attachments (1)

51866.diff (951 bytes) - added by pbiron 6 months ago.

Download all attachments as: .zip

Change History (6)

#1 @TimothyBlynJacobs
6 months ago

  • Component changed from General to Options, Meta APIs
  • Version changed from 5.5.3 to 5.5

The new parameter was introduced in [48505].

#2 @TimothyBlynJacobs
6 months ago

  • Keywords needs-patch good-first-bug added
  • Milestone changed from Awaiting Review to 5.7
  • Summary changed from Incompat "get_{$meta_type}_metadata" filters in wordpress/wp-includes/meta.php. to metadata_exists does not pass the meta_type to the get_{$meta_type}_metadata filter

@pbiron
6 months ago

#3 @pbiron
6 months ago

  • Keywords has-patch added; needs-patch removed

#4 @SergeyBiryukov
6 months ago

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

#5 @SergeyBiryukov
6 months ago

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

In 49699:

Options, Meta APIs: Pass $meta_type to the get_{$meta_type}_metadata filter in metadata_exists().

This matches the main instance of the filter in get_metadata_raw().

Follow-up to [48505].

Props pbiron, jsmoriss, TimothyBlynJacobs.
Fixes #51866.

Note: See TracTickets for help on using tickets.