[wp-hackers] wordpress function naming convention

Drew xoodrew at gmail.com
Thu Feb 21 23:11:02 UTC 2013


In my experience:

   - the_X() - These are called "Template Tags". Generally, they echo a
   formatted version of their "get_the_X" counterpart, though there are
   several exceptions to this.
   - get_the_X() - Returns something (usually used by Template Tags)
   - wp_the_X() - Basically the same as the_X() but not as front-facing as
   Template Tags. They *are* public functions though
   - wp_get_the_X() - Returns something (usually used by wp_the_X()
   functions)
   - _X() - Private functions for use by WordPress core only.

Anybody else, CMIIW.


On Thu, Feb 21, 2013 at 2:56 PM, Haluk Karamete <halukkaramete at gmail.com>wrote:

> Could someone guide as to what the convention is when we see a
> wordpress function which starts with one of these
>
> the_X()
>
> get_the_X()
>
> wp_the_X()
>
> wp_get_the_X()
>
> and very rarely some core functions start with _.
>
> as to the template tags, the convention is easy to understand, the_X
> outputs the X inline, whereas get_the_X returns the value.
>
> But for all the rest, not too sure.
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>



-- 
-- I've kinda got a thing for WordPress > http://www.drewapicture.com


More information about the wp-hackers mailing list