Pagination On A Single Post In WP

Quick Summary

  • Split a long post by adding the nextpage tag in the classic editor's Text tab, or a Page Break block in the block editor.
  • Add wp_link_pages() below the_content() in single.php, inside the Loop, to print numbered links to each page of the post.
  • Many themes already call wp_link_pages(), so check first to avoid duplicate links; posts without page breaks are unaffected.

Long posts are easier to read when they are split into several pages, each with its own URL. WordPress supports this out of the box with a page-break tag and one template function. If you want links to the previous and next posts instead, see previous and next post links for single posts.

Step 1: split the post

Open the post in the classic editor’s Text tab and add this tag wherever a new page should start:

PHP
<!--nextpage-->

Each tag starts a new page, so four tags split a post into five pages. In the block editor, insert a Page Break block, which adds the same tag.

Splitting the post is only half the job: visitors also need links to the other pages. Open your theme’s single.php (in a child theme, so updates don’t overwrite it) and add this line:

PHP
wp_link_pages();

Place it right below the call that prints the post content:

Code
the_content();

wp_link_pages() prints a “Pages:” line with a numbered link to each page of the current post. It only outputs something when the post contains a page break, so your other posts are not affected. It needs to run inside the Loop, which is why it goes next to the_content().

Many themes already call wp_link_pages() in single.php or in a template part. Check first, or the links will appear twice.

Share on X (opens in a new tab) Share on LinkedIn (opens in a new tab) Share on Facebook (opens in a new tab)

ChatGPT (opens in a new tab) Claude (opens in a new tab) Gemini (opens in a new tab) Perplexity (opens in a new tab) Grok (opens in a new tab)

More Insights

See More