WordPress the_content() Function

Beginner
6 min read
Updated: Nov 2026
3 examples
Prints the post body

Definition

In WordPress, the_content() prints the main body of the current post, the text you write in the editor. It is the most used tag in a theme.

It adds paragraphs, runs shortcodes and blocks, and handles the More tag. Use it inside The Loop.

Syntax

A few ways to call the_content().

WordPress
<?php
while ( have_posts() ) : the_post();
  the_content();
endwhile;
CallWhat it does
the_content()Print the post body.
the_content( 'Read more' )Use your own text for the More link.
get_the_content()Return the raw content, without filters.
apply_filters( 'the_content', get_the_content() )Return the content with filters applied.

It prints the content after all filters ran. On a list page it stops at the More tag and adds a link.

Full declaration
WordPress
the_content( string $more_link_text = null, bool $strip_teaser = false ): void

Parameters

ParameterDescription
$more_link_textstring. The text of the More link. Default is (more...) with the post title for screen readers.
$strip_teaserbool. true hides the text before the More tag. Default is false.

Return Value

Return ValueDescription
voidNothing is returned. The content is printed.

WordPress Examples

Three short examples. Each one shows the code and what it prints.

Example 1 — Print the post body

Show the content inside The Loop.

WordPress
<?php while ( have_posts() ) : the_post(); ?>
  <h1><?php the_title(); ?></h1>
  <div class="entry">
    <?php the_content(); ?>
  </div>
<?php endwhile; ?>

How It Works

  1. the_post() sets up the current post.
  2. the_content() prints the post body with paragraphs.
  3. The wrapper div is ours.

Example 2 — Change the More link text

On a list page, the post stops at the More tag. Pass text for the link.

WordPress
<?php the_content( 'Continue reading' ); ?>

How It Works

  1. The author placed a More tag in the editor.
  2. On a list page the text after it is hidden.
  3. A link with your text is printed instead.

Example 3 — Get the content as text

Use get_the_content() when you need to work with it, for example to count words.

WordPress
<?php
$text  = wp_strip_all_tags( get_the_content() );
$words = str_word_count( $text );
echo 'About ' . intval( $words ) . ' words';

How It Works

  1. get_the_content() returns the content as a string.
  2. wp_strip_all_tags() removes HTML tags.
  3. str_word_count() counts the words.

Frequently Asked Questions

It prints the main body of the current post with paragraphs, blocks, and shortcodes processed.
Yes. the_content() works on the current post of The Loop.
the_content() prints the full post. the_excerpt() prints a short summary.
On a list page, the post is cut at the More tag and a link to the full post is printed.
Use get_the_content(). Apply the the_content filter if you also want shortcodes and paragraphs.

Browse all post functions

Open the functions index for simple guides with examples and FAQs.

Post Functions Index →

About the author

Mari Selvan M P
Mari Selvan M P 🔗

Developer, cloud engineer, and technical writer

  • Experience 12 years building web and cloud systems
  • Focus Full Stack Development, AWS, and Developer Education

I write practical tutorials so students and working developers can learn by doing—from databases and APIs to deployment on AWS.

8 people found this page helpful