WordPress Template Tags (162 Types)

Last Updated:

A list of all 162 template tags that can be used in WordPress. You can check the list of template tags and descriptions. Let's see what template tags are available.

What are Template Tags?

There are many useful functions available in WordPress. A template tag is a function that is used within the template file of a theme, among other functions.

Use it to dynamically display your blog’s data and to customize your theme.

The template tag also includes functions that can output a variety of information by specifying arguments (parameters).

How to use the template tag

Template tags are placed in PHP’s start and end tags. The template tag must end with a semicolon (;) to indicate the end of the code.

<?php the_content(); ?>

Template tag definition file

Template tags are defined in 9 files under wp-includes.

Template Tag List

The following is a list of template tags that can be used in WordPress. You can review the tags and their descriptions.

General tags

These are the 29 template tags defined in “wp-includes/general-template.php”.

Template TagDescription
get_header()Load header template
get_footer()Load footer template
get_sidebar()Load sidebar template
get_template_part()Loads a template part into a template
get_search_form()Display search form
wp_loginout()Display the Log In/Out link
wp_logout_url()Retrieves the logout URL
wp_login_url()Retrieves the login URL
wp_login_form()Provides a simple login form for use anywhere within WordPress
wp_lostpassword_url()Returns the URL that allows the user to retrieve the lost password
wp_register()Display the Registration or Admin link
wp_meta()Theme container function for the ‘wp_meta’ action
bloginfo()Displays information about the current site
get_bloginfo()Retrieves information about the current site
get_current_blog_id()Retrieve the current site ID
wp_title()Display or retrieve page title for all areas of blog
single_post_title()Display or retrieve page title for post
post_type_archive_title()Display or retrieve title for a post type archive
single_cat_title()Display or retrieve page title for category archive
single_tag_title()Display or retrieve page title for tag post archive
single_term_title()Display or retrieve page title for taxonomy term archive
single_month_title()Display or retrieve page title for post archive based on date
get_archives_link()Retrieve archive link content based on predefined or custom code
wp_get_archives()Display archive links based on type and format
calendar_week_mod()Get number of days since the start of the week
get_calendar()Display calendar with days that have posts as links
delete_get_calendar_cache()Purge the cached results of get_calendar
allowed_tags()Display all of the allowed tags in HTML format with attributes
wp_enqueue_script()Enqueue a script

Author tags

These are the 10 template tags defined in “wp-includes/author-template.php”.

Template TagDescription
the_author()Display the name of the author of the current post
get_the_author()Retrieve the author of the current post
the_author_link()Display either author’s link or author’s name
get_the_author_link()Retrieve either author’s link or author’s name
the_author_meta()Outputs the field from the user’s DB object. Defaults to current post’s author
the_author_posts()Display the number of posts by the author of the current post
the_author_posts_link()Displays an HTML link to the author page of the current post’s author
wp_dropdown_users()Create dropdown HTML content of users
wp_list_authors()List all the authors of the site, with several options available
get_author_posts_url()Retrieve the URL to the author page for the user with the ID provided

Bookmark tags

These are the 4 template tags defined in “wp-includes/bookmark-template.php”.

Template TagDescription
wp_list_bookmarks()Retrieve or echo all of the bookmarks
get_bookmark()Retrieve Bookmark data
get_bookmark_field()Retrieve single bookmark data item or field
get_bookmarks()Retrieves the list of bookmarks

Category tags

These are the 16 template tags defined in “wp-includes/category-template.php”.

Template TagDescription
category_description()Retrieves category description
single_cat_title()Display or retrieve page title for category archive
the_category()Displays category list for a post in either HTML list or custom format
the_category_rss()Display the post categories in the feed
wp_dropdown_categories()Displays or retrieves the HTML dropdown list of categories
wp_list_categories()Displays or retrieves the HTML list of categories
single_tag_title()Display or retrieve page title for tag post archive
tag_description()Retrieves tag description
the_tags()Displays the tags for a post
wp_generate_tag_cloud()Generates a tag cloud (heatmap) from provided data
wp_tag_cloud()Displays a tag cloud
term_description()Retrieves term description
single_term_title()Display or retrieve page title for taxonomy term archive
get_the_term_list()Retrieves a post’s terms as a list with specified format
the_terms()Displays the terms for a post in a list
the_taxonomies()Display the taxonomies of a post with available options

Comment tags

These are the 29 template tags defined in “wp-includes/comment-template.php”.

Template TagDescription
cancel_comment_reply_link()Displays HTML content for cancel comment reply link
comment_author()Displays the author of the current comment
comment_author_email()Displays the email of the author of the current global $comment
comment_author_email_link()Displays the HTML email link to the author of the current comment
comment_author_IP()Displays the IP address of the author of the current comment
comment_author_link()Displays the HTML link to the URL of the author of the current comment
comment_author_rss()Display the current comment author in the feed
comment_author_url()Displays the URL of the author of the current comment, not linked
comment_author_url_link()Displays the HTML link of the URL of the author of the current comment
comment_class()Generates semantic classes for each comment element
comment_date()Displays the comment date of the current comment
comment_excerpt()Displays the excerpt of the current comment
comment_form_title()Displays text based on comment reply status
comment_form()Outputs a complete commenting form for use within a template
comment_ID()Displays the comment ID of the current comment
comment_id_fields()Outputs hidden input HTML for replying to comments
comment_reply_link()Displays the HTML content for reply to comment link
comment_text()Displays the text of the current comment
comment_text_rss()Display the current comment content for use in the feeds
comment_time()Displays the comment time of the current comment
comment_type()Displays the comment type of the current comment
comments_link()Displays the link to the current post comments
comments_number()Displays the language string for the number of comments the current post has
comments_popup_link()Displays the link to the comments for the current post ID
get_avatar()Retrieve the avatar <img> tag for a user, email address, MD5 hash, comment, or post
next_comments_link()Displays the link to the next comments page
paginate_comments_links()Displays or retrieves pagination links for the comments on the current post
previous_comments_link()Displays the link to the previous comments page
wp_list_comments()Displays a list of comments

Link tags

These are the 25 template tags defined in “wp-includes/link-template.php”.

Template TagDescription
the_permalink()Displays the permalink for the current post
user_trailingslashit()Retrieves a trailing-slashed string if the site is set for adding trailing slashes
permalink_anchor()Displays the permalink anchor for the current post
get_permalink()Retrieves the full permalink for the current post or post ID
get_post_permalink()Retrieves the permalink for a post of a custom post type
get_page_link()Retrieves the permalink for the current page or page ID
get_attachment_link()Retrieves the permalink for an attachment
wp_shortlink_header()Sends a Link: rel=shortlink header if a shortlink is defined for the current page
wp_shortlink_wp_head()Injects rel=shortlink into the head if a shortlink is defined for the current page
edit_bookmark_link()Displays the edit bookmark link anchor content
edit_comment_link()Displays the edit comment link with formatting
edit_post_link()Displays the edit post link for post
get_edit_post_link()Retrieves the edit post link for post
get_delete_post_link()Retrieves the delete posts link for post
edit_tag_link()Displays or retrieves the edit link for a tag with formatting
get_admin_url()Retrieves the URL to the admin area for a given site.
get_home_url()Retrieves the URL for a given site where the front end is accessible
get_site_url()Retrieves the URL for a given site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible
home_url()Retrieves the URL for the current site where the front end is accessible
site_url()Retrieves the URL for the current site where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are accessible
get_search_link()Retrieves the permalink for a search
get_search_query()Retrieves the contents of the search WordPress query variable
the_feed_link()Displays the permalink for the feed type
the_privacy_policy_link()Displays the privacy policy link with formatting, when applicable
get_the_privacy_policy_link()Returns the privacy policy link with formatting, when applicable

Post tags

These are the 43 template tags defined in “wp-includes/post-template.php”.

Template TagDescription
body_class()Displays the class names for the body element
next_image_link()Displays next image link that has the same post parent
next_post_link()Displays the next post link that is adjacent to the current post
next_posts_link()Displays the next posts page link
post_class()Displays the classes for the post container element
post_password_required()Whether post requires password and correct password has been provided
posts_nav_link()Displays the post pages link navigation for previous and next pages
previous_image_link()Displays previous image link that has the same post parent
previous_post_link()Displays the previous post link that is adjacent to the current post
previous_posts_link()Displays the previous posts page link
single_post_title()Display or retrieve page title for post
the_category()Displays category list for a post in either HTML list or custom format
the_category_rss()Display the post categories in the feed
the_content()Display the post content
the_excerpt()Display the post excerpt
the_excerpt_rss()Display the post excerpt for the feed
the_ID()Display the ID of the current item in the WordPress Loop
the_meta()Display a list of post custom fields
the_tags()Displays the tags for a post
the_title()Display or retrieve the current post title with optional markup
get_the_title()Retrieve post title
the_title_attribute()Sanitize the current title when retrieving or displaying
the_title_rss()Display the post title in the feed
wp_link_pages()The formatted output of a list of pages
get_attachment_link()Retrieves the permalink for an attachment
wp_get_attachment_link()Retrieve an attachment page link using an image or icon, if possible
the_attachment_link()Display an attachment page link using an image or icon
the_search_query()Displays the contents of the search query variable
is_attachment()Determines whether the query is for an existing attachment page
wp_attachment_is_image()Determines whether an attachment is an image
wp_get_attachment_image()Get an HTML img element representing an image attachment
wp_get_attachment_image_src()Retrieves an image to represent an attachment
wp_get_attachment_metadata()Retrieves attachment metadata for attachment ID
get_the_date()Retrieve the date on which the post was written
single_month_title()Display or retrieve page title for post archive based on date
the_date()Display or Retrieve the date the current post was written (once per date)
the_date_xml()Outputs the date in iso8601 format for xml files
the_modified_author()Display the name of the author who last edited the current post, if the author’s ID is available
the_modified_date()Display the date on which the post was last modified
the_modified_time()Display the time at which the post was last modified
the_time()Display the time at which the post was written
the_shortlink()Displays the shortlink for a post
wp_get_shortlink()Returns a shortlink for a post, page, attachment, or site

Post Thumbnail tags

These are the 4 template tags defined in “wp-includes/post-thumbnail-template.php”.

Template TagDescription
has_post_thumbnail()Determines whether a post has an image attached
get_post_thumbnail_id()Retrieve post thumbnail ID
the_post_thumbnail()Display the post thumbnail
get_the_post_thumbnail()Retrieve the post thumbnail

Navigation Menu tags

These are the 2 template tags defined in “wp-includes/nav-menu-template.php”.

Template TagDescription
wp_nav_menu()Displays a navigation menu
walk_nav_menu_tree()Retrieves the HTML list content for nav menu items

Most Popular Articles

  1. What’s new in WordPress 5.5? New Features and Changes
  2. How to Add width/height to Images in WordPress
  3. WordPress Version List (Release Date/Code Name)
  4. What is WordPress’ server requirement? Support for Each Version
  5. What is a WordPress child theme? Tutorial to create a child theme

New Articles

go to top