Ready to get started?Download WordPress


Attention Interested in functions, hooks, classes, or methods? Check out the new WordPress Code Reference!

Function Reference/get the title


This function will return the title of a post for a given post ID. If the post is protected or private, the word "Protected: " or "Private: " will be prepended to the title. It can be used inside or outside of The Loop. If used outside the loop an ID must be specified.


 <?php echo get_the_title($ID); ?> 


(integer or object) (optional) The ID of the post or an object that specifies the post from which to get the title. By default the current post is fetched.
Default: null

Return Values

Post title. If the post is protected or private, the word "Protected: " or "Private: " prepended to the title.


Print the current post's title  <?php echo get_the_title(); ?> 

Simple breadcrumb trail for pages, two levels deep.

<div class='breadcrumb'>
<?php // if there is a parent, display the link
$parent_title = get_the_title($post->post_parent);
if ( $parent_title != the_title(' ', ' ', false) ) {
  echo '<a href=' . get_permalink($post->post_parent)
    . ' ' . 'title=' . $parent_title . '>' . $parent_title
    . '</a> » ';
// then go on to the current page link
<a href='<?php the_permalink() ?>'
rel='bookmark' title='<?php the_title_attribute(); ?>'>
<?php the_title(); ?></a> »

Change Log

Since: 0.71

Source File

get_the_title() is located in wp-includes/post-template.php.


See also index of Function Reference and index of Template Tags.
This page is marked as incomplete. You can help Codex by expanding it.