Languages: English • Italiano • 日本語 한국어 • Русский • Português do Brasil • (Add your language)
Displays or returns the unescaped title of the current post. This tag may only be used within The Loop, to get the title of a post outside of the loop use get_the_title. If the post is protected or private, this will be noted by the words "Protected: " or "Private: " prepended to the title.
<?php the_title( $before, $after, $echo ); ?>
<?php the_title( '<h3>', '</h3>' ); ?>
This would print the title to the screen as an h3.
Like the_content() , the output of the_title() is unescaped. This is considered a feature and not a bug, see the FAQ "Why are some users allowed to post unfiltered HTML?" . If the post title is <script>alert("test");</script>, then that Javascript code will be run wherever the_title() is used. For this reason, do not write code that allows untrusted users to create post titles.
Since: 0.71
the_title() is located in wp-includes/post-template.php
.