the_content()WP 0.71

Display the post content. It is template tag and must be used inside the loop.

Besides using this function in the loop, it can be used on a single page like page.php, single.php.

When the function is used on archive pages (not a single page) and if the content uses the tag-separator <!--more-->, the_content() will cut the text: anything above <!--more--> will be shown, and everything after this tag will be cut and replaced with link "read more" (link text can be changed by specifying the parameter $more_link_text).

1 time — 0.019477 sec (extremely slow) | 50000 times — 11.65 sec (slow) | PHP 7.1.11, WP 4.9.6
Hooks from the function


null. Nothing (null). Shows on the screen formatted post content.


<?php the_content( $more_link_text, $strip_teaser ); ?>
Text of the read more... link. Default is: (more...)
Default: null

Strip teaser content before the more text.

The word "teaser" means the attracting text before the <!--more-->. If you set this parameter to true, the content before the <!--more--> tag on the is_single() page will be removed.

Also, you can delete content before the more tag by specifying the <!--noteaser--> tag anywhere in the post content. Usually <!--noteaser--> tag is placed right after <!--more--> tag.

Default: false



#1 Changing "more..." link text

If you want to change the standard link text that displays when the content is split by the <!--more--> then specify the required text in the first parameter of the function:

<?php the_content( 'Go to full text...' ); ?>

#2 Insert the post title in the "more..." link text

You can use the_title() function to insert post title into "more" text of the link:

<?php the_content( 'reed more: ' . the_title('', '', false) ); ?>

#3 Change the behavior of the function, relative to the text clipping tag <!--more-->

If the function does not cut the text on the tag <!--more--> or vice versa, cuts where we don't need it, then you can change the variable $more, thereby specifying the cut (0) or not cut (1) the text.

global $more;    // Declare variable $more as a global (before the WordPress Loop).
$more = 0;       // Change the value of the variable to show only the text before the more tag.
the_content( 'reed more...' );

or if you want to leave the content as is:

global $more;
$more = 1;       // ignore more tag (do not cut).

#4 Ignore the "more" tag for sticky posts

This example displays full content for sticky posts (even if they have the "more" tag), but the rest of the posts will be truncated:

global $more; // Let's declare $more variable as global.
if( is_sticky() ){
	$more = 1;
else {
	$more = 0;
	the_content( 'Read the rest of this entry »' );

#5 Alternative useage

If you want to get the content of a post for processing in php but not display it, you can use the get_the_content() function:

$content = get_the_content();

However, you should keep in mind that the resulting content (which is now in the $content variable) is NOT filtered. To filter it you need to run it through the filter the_content:

$content = apply_filters( 'the_content', $content );
$content = str_replace( ']]>', ']]&gt;', $content );


Since 0.71 Introduced.

the_content() code WP 6.3

function the_content( $more_link_text = null, $strip_teaser = false ) {
	$content = get_the_content( $more_link_text, $strip_teaser );

	 * Filters the post content.
	 * @since 0.71
	 * @param string $content Content of the current post.
	$content = apply_filters( 'the_content', $content );
	$content = str_replace( ']]>', ']]&gt;', $content );
	echo $content;