[wp-hackers] Returning instead of echoing

Michael Heilemann michael at binarybonsai.com
Sat Nov 6 20:46:28 UTC 2004


I've been wondering for some time now. In fact, ever since I started to 
learn a bit of PHP, so that I could write Kubrick 
(binarybonsai.com/kubrick), why on God's green Earth the majority of 
the functions in WordPress echo rather than return their results?

I can't really come up with any particular reason for doing it this 
way, rather than simply returning the result for easy inline parsing if 
needed...

The way it is now, when I for instance want to add a title="" to the 
comment link, I have to dig out the code somewhere inside the core of 
WordPress and change it. Which I can deal with... Until the next 
version rolls around and I have to deal with upgrading my hacked 
codebase.

If instead comments_popup_link was divided into two seperate functions, 
one for fetching the URI, and one for fetching the number of comments, 
I could echo them out and do whatever the devil I wanted with them...

Am I missing something?

Aloha, Mike
http://binarybonsai.com




More information about the hackers mailing list