[wp-trac] [WordPress Trac] #23882: get_permalink() accepts an ID, the_permalink() does not
WordPress Trac
noreply at wordpress.org
Fri Oct 9 10:40:56 UTC 2015
#23882: get_permalink() accepts an ID, the_permalink() does not
-------------------------------------------+------------------------
Reporter: johnjamesjacoby | Owner: chriscct7
Type: enhancement | Status: reopened
Priority: normal | Milestone: 4.4
Component: Permalinks | Version: 3.5
Severity: normal | Resolution:
Keywords: has-patch commit dev-feedback | Focuses:
-------------------------------------------+------------------------
Comment (by chriscct7):
the_permalink doesn't do anything that get_permalink doesn't already do by
default. In fact, as it stands, it's simply a wrapper for get_permalink:
{{{
function the_permalink() {
/**
* Filter the display of the permalink for the current
post.
*
* @since 1.5.0
*
* @param string $permalink The permalink for the current
post.
*/
echo esc_url( apply_filters( 'the_permalink',
get_permalink() ) );
}
}}}
The patch doesn't do anything to change the behavior of the parameter.
This is because if no parameter is passed in for ID, the 0 is passed into
get_permalink which is the default value get_permalink gets in anyways in
the event of no $id value, thus there is no backwards compatibility
concerns on it.
In order to have any sort of changed functionality, you'd have to send in
a value for the parameter of the_permalink, in which case, which is new
functionality, and is being explicitly set, so the the_permalink filter
isn't a concern here. I'll update the patch to add the parameter.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/23882#comment:9>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list