WordPress.org

Make WordPress Core

Opened 5 years ago

Closed 5 years ago

#35015 closed enhancement (fixed)

Pass $id to filters in the_guid and get_the_guid()

Reported by: danielbachhuber Owned by: SergeyBiryukov
Milestone: 4.5 Priority: normal
Severity: normal Version:
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

Because $id can be passed to the_guid(), filter callbacks can't be 100% precise by assuming $id should be the global post.

Attachments (2)

35015.1.diff (1.0 KB) - added by danielbachhuber 5 years ago.
35015.2.diff (1.9 KB) - added by SergeyBiryukov 5 years ago.

Download all attachments as: .zip

Change History (5)

#1 @SergeyBiryukov
5 years ago

In get_the_title(), if $id is 0 or a post object, we resolve it and pass the actual post ID to the filter.

We should probably do the same here. See 35015.2.diff.

Version 0, edited 5 years ago by SergeyBiryukov (next)

#2 @danielbachhuber
5 years ago

Works for me!

#3 @SergeyBiryukov
5 years ago

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

In 35867:

Post Template: Pass the post ID to the_guid and get_the_guid filters.

Props danielbachhuber for initial patch.
Fixes #35015.

Note: See TracTickets for help on using tickets.