WordPress.org

Make WordPress Core

Opened 13 months ago

Last modified 4 months ago

#23882 new enhancement

get_permalink() accepts an ID, the_permalink() does not

Reported by: johnjamesjacoby Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.5
Component: Permalinks Keywords: has-patch
Focuses: Cc:

Description (last modified by johnjamesjacoby)

I always found it odd that the_permalink() doesn't accept a post ID passed into it, when get_permalink() does, and the_permalink() just calls get_permalink().

After scouring trac for a duplicate (and not finding one) I've attached a patch to improve this.

Related: #1271

Attachments (1)

23882.patch (611 bytes) - added by johnjamesjacoby 13 months ago.
Add $id and $leavename params to the_permalink(), to match get_the_permalink()

Download all attachments as: .zip

Change History (5)

johnjamesjacoby13 months ago

Add $id and $leavename params to the_permalink(), to match get_the_permalink()

comment:1 SergeyBiryukov13 months ago

  • Version changed from trunk to 3.5

comment:2 nacin13 months ago

get_the_permalink() is actually get_permalink(). I don't think it's necessary for $leavename — which is designed for creating sample and generic permalinks, etc — to make its way into the_permalink(). Fine with $id.

comment:3 jb51013 months ago

Thank you... drove me crazy for a long time too -- patch worked in my basic testing.

comment:4 johnjamesjacoby4 months ago

  • Description modified (diff)
  • Summary changed from get_the_permalink() accepts an ID, the_permalink() does not to get_permalink() accepts an ID, the_permalink() does not
Note: See TracTickets for help on using tickets.