WordPress Post Functions

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().
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.
<?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 functionsPrint titles, post text, summaries, and page breaks.
| Function | Description | Tutorial |
|---|---|---|
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 functionsShow when a post was published or edited, and archive titles.
| Function | Description | Tutorial |
|---|---|---|
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 functionsCSS classes, IDs, custom fields, and short links.
| Function | Description | Tutorial |
|---|---|---|
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 functionsShow the categories and tags of a post.
| Function | Description | Tutorial |
|---|---|---|
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 functionsWork with files and images in the Media Library.
| Function | Description | Tutorial |
|---|---|---|
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
Start with the_title()
Print the title of a post, with simple examples.
12 people found this page helpful
