Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

WordPress WordPress Theme Development Adding a Blog to a WordPress Theme Adding a Blog to a WordPress Theme Quiz

Juan Antonio Roig Bernat
Juan Antonio Roig Bernat
5,543 Points

What the difference between "get_" and "the_" at the begining of the wordpress functions?

I don`t get understand really well the difference between "get_" and "the_" at the begining of the wordpress functions. Could someone explain this or share some good link or tutorial that treats this on deep please?

Thank you in advance.

1 Answer

Sue Dough
Sue Dough
35,800 Points

Good question.

get_ just GETS the information to perhaps store in a variable

the_ will print the information out

<?php the_content(); ?>

will output

Test content

VS

<?php get_the_content(); ?>

will output nothing


To use get and output

<?php $content = get_the_content();
echo $content; ?>

will output

Test content
Juan Antonio Roig Bernat
Juan Antonio Roig Bernat
5,543 Points

Wow! Clear as water! :D Thank you very much Sue!

Sue Dough
Sue Dough
35,800 Points

Glad I could help.

:)