Home WordPress Posts WordPress Posts Definition
Definition A post is the main kind of content in WordPress, such as a blog article. Each post has a title, text, a date, and often categories and tags. You write posts in the admin, and your theme decides how they look.
A theme shows posts with The Loop . The Loop goes through the posts for the page, and inside it you call template tags such as the_title() and the_content() .
Remember. Most the_* tags work on the current post , so they need The Loop. Call the_post() first, and then print what you need.
Syntax
The Loop This is the shape of almost every theme template.
<?php
if ( have_posts() ) :
while ( have_posts() ) : the_post();
// template tags go here
endwhile;
endif; have_posts() asks if there are posts left. the_post() moves to the next post and sets it as the current one.
Compare
the_* Prints, get_* Returns Many tags come in two forms. Pick the one that fits what you want to do.
Escape what you return. When you print a returned value, escape it. For example, write echo esc_html( get_the_title() );. The printing tags already do this work for you.
Code
WordPress Examples Two short examples with sample output.
1. Show a title and the content 2. Show the date safely Example 1 — Show a title and the content Use The Loop and two tags to build a simple post page.
<?php while ( have_posts() ) : the_post(); ?>
<article>
<?php the_title( '<h1>', '</h1>' ); ?>
<?php the_content(); ?>
</article>
<?php endwhile; ?> <article>
<h1>Hello World</h1>
<p>Welcome to WordPress. This is your first post.</p>
</article> How It Works the_post() sets the current post for the tags below it.the_title() prints the title inside an h1.the_content() prints the post body.Example 2 — Show the date safely Use get_the_date() because it returns the date, and then escape it.
<?php while ( have_posts() ) : the_post(); ?>
<p>
Published on
<?php echo esc_html( get_the_date( 'F j, Y' ) ); ?>
</p>
<?php endwhile; ?> <p>
Published on
November 12, 2026
</p> How It Works get_the_date( 'F j, Y' ) returns the date as text.esc_html() makes the text safe to print.Unlike the_date(), it shows the date for every post, even on the same day. Continue
Next: WordPress Post Functions Now that you know the basics, open the functions index for all 43 guides.
Full list: WordPress Post Functions index (/wordpress/post/function).
Frequently Asked Questions What is a WordPress post? A post is a piece of content you write in the editor, such as a blog article. It has a title, content, date, categories, and tags.
What is The Loop? The Loop is the PHP code that goes through the posts for the current page. Inside it you call tags like the_title() and the_content().
What is the difference between the_title() and get_the_title()? the_title() prints the title. get_the_title() returns it, so you can store it or change it. Escape it with esc_html() when you print it.
Which file shows a single post? single.php. The blog list and archives use index.php and archive.php.
Do all post tags need The Loop? Most the_* tags do, because they work on the current post. Some, like get_the_title( 12 ), also work with a post ID.
Where can I see every post function? Open the WordPress Post Functions index. It lists all 43 guides in short tables.
Browse every post function Open the functions index for simple guides with examples and FAQs.
Post Functions Index → About the author Developer, cloud engineer, and technical writer
I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.
10 people found this page helpful
Helpful Share Copy link Suggestion