WordPress Post Functions

Beginner
8 min read
Updated: Nov 2026
43 function guides
Function index

About This Index

This page is the WordPress Post Functions index. Each row links to a full guide with syntax, three examples, and FAQs.

Learn the big picture on WordPress Posts. Use this page when you need one function, such as the_title(), the_content(), or get_the_date().

Remember.

Most the_* tags need The Loop. Tags that start with the_ print, and tags that start with get_ return a value.

How to Call a Post Function

Start The Loop, then call the tags you need for each post.

WordPress
<?php
while ( have_posts() ) : the_post();
  the_title( '<h1>', '</h1>' );
  echo esc_html( get_the_date() );
  the_content();
endwhile;

WordPress Post Functions Table

All function guides in this WordPress post series (43 tutorials). Start with the_title().

Title and Content

9 functions

Print titles, post text, summaries, and page breaks.

FunctionDescriptionTutorial
the_title()Print the title of the current post.Read guide
get_the_title()Return the title of a post as a string instead of printing it.Read guide
the_title_attribute()Print the post title in a safe form for use inside an HTML attribute.Read guide
the_title_rss()Print the post title for an RSS feed.Read guide
the_content()Print the full content of the current post.Read guide
the_excerpt()Print a short summary of the current post.Read guide
the_excerpt_rss()Print the excerpt of the current post for an RSS feed.Read guide
wp_link_pages()Print page number links for a post that is split into pages.Read guide
post_password_required()Check if a post is password protected and the visitor has not entered the password yet.Read guide

Date and Time

8 functions

Show when a post was published or edited, and archive titles.

FunctionDescriptionTutorial
the_date()Print the date of the current post, but only once for each day in a loop.Read guide
get_the_date()Return the date a post was published, in any format you choose.Read guide
the_time()Print the time or date of the current post, every time it is called.Read guide
the_date_xml()Print the date of the current post in YYYY-MM-DD format.Read guide
the_modified_date()Print the date a post was last changed.Read guide
the_modified_time()Print the time a post was last changed.Read guide
single_month_title()Print or return the month and year of a monthly archive page.Read guide
single_post_title()Print or return the title of the post or page being viewed.Read guide

Classes and Meta

8 functions

CSS classes, IDs, custom fields, and short links.

FunctionDescriptionTutorial
body_class()Print a class attribute for the body tag so you can style each page type.Read guide
post_class()Print a class attribute for a post wrapper, with the post type, ID, and terms.Read guide
the_ID()Print the ID number of the current post.Read guide
the_meta()Print all public custom fields of the current post as a list.Read guide
the_modified_author()Print the name of the user who last edited the current post.Read guide
the_search_query()Print the search words the visitor typed, safely escaped.Read guide
the_shortlink()Print a link to the short URL of the current post.Read guide
wp_get_shortlink()Return the short URL of a post as a string.Read guide

Categories and Tags

3 functions

Show the categories and tags of a post.

FunctionDescriptionTutorial
the_category()Print the categories of a post as links.Read guide
the_category_rss()Print the categories and tags of a post as XML tags for an RSS feed.Read guide
the_tags()Print the tags of a post as links.Read guide

Attachments and Images

10 functions

Work with files and images in the Media Library.

FunctionDescriptionTutorial
is_attachment()Check if the current page is an attachment page.Read guide
get_attachment_link()Return the URL of an attachment page, such as the page for one image.Read guide
the_attachment_link()Print a link to an attachment, shown as a thumbnail or as the full image.Read guide
next_image_link()Print a link to the next image in a post gallery, on an attachment page.Read guide
previous_image_link()Print a link to the previous image in a post gallery, on an attachment page.Read guide
wp_attachment_is_image()Check if an attachment is an image.Read guide
wp_get_attachment_image()Return the HTML of an image tag for an attachment ID and size.Read guide
wp_get_attachment_image_src()Return the URL, width, and height of an attachment image in an array.Read guide
wp_get_attachment_link()Return an anchor tag for an attachment, with a thumbnail or text inside.Read guide
wp_get_attachment_metadata()Return the saved details of an attachment, such as width, height, and sizes.Read guide

Frequently Asked Questions

They are template tags that print or return parts of a post, such as the title, content, date, categories, and links to other posts.
In theme files such as single.php, index.php, and archive.php. Most of them work inside The Loop.
Functions that start with the_ print a value. Functions that start with get_ return it, so you can store it or change it first.
Use the_title() to print it, or get_the_title() to return it. Escape the returned title with esc_html() when you print it.
the_date() prints only once for each day in a loop. Use get_the_date() or the_time() to show a date for every post.
Use next_post_link() and previous_post_link() on single posts. Use next_posts_link() and previous_posts_link() on lists of posts.

Start with the_title()

Print the title of a post, with simple examples.

the_title() tutorial →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

12 people found this page helpful