[wp-trac] [WordPress Trac] #23882: get_permalink() accepts an ID, the_permalink() does not

WordPress Trac noreply at wordpress.org
Fri Oct 9 12:07:44 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 Frank Klein):

 I am aware that `the_permalink()` is simply a wrapper for the getter
 function. The Template Tags are WordPress' version of a templating engine,
 so a lot of the functions just wrap the getters and rely on the Loop to
 print the correct data.

 `the_title_attribute()` is a bad example IMO, because it has an `echo`
 parameter, so it can be used both as a getter and a Template Tag.

 I also feel that incorrect code samples in documentation is not really a
 valid argument for extending an API.

 I'm also aware that besides the filter argument, which IMO definitely does
 modify existing behavior, this function does not change if you don't use
 the ID parameter.

 But I think that adding a parameter would change the function from being a
 pure Template Tag towards something that is mixed. This would break with
 the existing conventions of how templating works (for the most part due to
 backwards compatibility reasons) in WordPress, and therefore isn't a
 worthwhile addition because the gain of adding the parameter in view of
 these downsides isn't worth it.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/23882#comment:12>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list