the_title(), the_content(), the_permalink(), etc inconsistencies
|Reported by:||archon810||Owned by:|
After looking at the_title(), the_content(), and the_permalink() functions, I saw that all of them, at least in WP 2.7.1 by default just echo everything and don't return anything back.
the_title(), however, supports a flag that says do not print and return instead, like so
the_title(null, null, false)
The other 2, however, don't have such flags, and such inconsistency is quite shocking to me.
Indeed, a call to get_the_SOMETHING() functions could be wrapped into an apply_filters() function but I think it is
- for the_content() with the 3rd flag=false and get_the_content(), it provides duplicate and inconsistent with other fucntions functionality
- some the_SOMETHING() functions do additional processing after the get_the_SOMETHING() calls, for example the_content()
I've opened a Stack Overflow question to get to the bottom of this but so far nobody offered an acceptable solution.
A similar ticket #7166 has been closed as "wontfix" but it offered a different solution and was indeed superfluous.
A solution is to allow all the_SOMETHING() functions to skip printing and being able to specify a flag to return data instead, like the_title() does. Please do not close simply because this ticket reminds you of #7166 and instead discuss :)
Change History (8)
- Component changed from General to Template
- Milestone changed from Unassigned to Future Release
- Milestone Future Release deleted
- Resolution set to worksforme
- Status changed from new to closed