The difference between get and the in WordPress

Across WordPress’s documentation and code, you might notice some functions that are named similarly, the difference being get_ added to the function’s name.

For example: the_title(); and get_the_title();

The

The use of the shorter version echoes the value. For example, if one were to use the following on this page:

the_title();

“The difference between get and the in WordPress” would appear on the page.

Get

The get version returns the value. If you wanted to display the title on the page using this function, you would use it as so:

echo get_the_title();

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top