Make WordPress Core

#37751 closed defect (bug) (fixed)

Incorrect $format passed to the oembed_endpoint_url filter

Reported by: swissspidy Owned by: SergeyBiryukov
Milestone: 4.7 Priority: normal
Severity: normal Version: 4.4
Component: Embeds Keywords: good-first-bug has-patch
Focuses: docs Cc:


In get_oembed_endpoint_url(). $format is set to false when JSON is passed as the format.

This is done so that the JSON format (which is the default) isn't unnecessarily appended to the URL.

However, when using the oembed_endpoint_url filter, $format is always false in that case. The filter docs state a string is passed, so this is unexpected behaviour.

The add_query_arg() part should be changed to read something like format' => ( 'json' === $format ) ? false : $format,

Attachments (1)

37751.diff (487 bytes) - added by danhgilmore 22 months ago.
Patch to check if format is JSON in add_query_arg()

Download all attachments as: .zip

Change History (3)

22 months ago

Patch to check if format is JSON in add_query_arg()

#1 @danhgilmore
22 months ago

  • Keywords has-patch added; needs-patch removed

#2 @SergeyBiryukov
22 months ago

  • Owner set to SergeyBiryukov
  • Resolution set to fixed
  • Status changed from new to closed

In 38321:

Embeds: In get_oembed_endpoint_url(), avoid inadvertent stomping of the $format parameter passed to oembed_endpoint_url filter.

Props danhgilmore.
Fixes #37751.

Note: See TracTickets for help on using tickets.