Move Pagination Directly Under Post in WordPress


Last updated on August 6th, 2023 at 02:20 am

Read Time:1 Minute, 57 Second

When using the WordPress pagination feature, with some themes it can end up being out of the way and your visitors might not see it. This can cause issues where your visitors will get frustrated and leave your website. This also then starts to push up your bounce rate.

I had this problem so I wanted my pagination buttons to be directly underneath my post so that it was clear to my visitors how to get to the next page.

Plugin v Code

There are a number of plugins you can use to do this but I already use far too many plugins as it is, so I wanted to code it into my theme.

I started Googling how to do this and came across a post on Stack Exchange offering a solution. I tested it out and it worked a treat.

Below is the code that allows you to have your pagination buttons just below your post. This should be copied and pasted into your functions.php file – I suggest adding this to your child theme so that it does not disappear on the next theme update.

Pagination Buttons Code

<?php // move pagination links above other end-of-post content additions, like related posts etc.
function move_pagination( $content ) {
if ( is_single() ) {
$pagination = wp_link_pages( array(
'before' => '<div class="page-links"><span class="page-links-title">' . __( 'Pages:', 'firmness' ) . '</span>',
'after' => '</div>',
'link_before' => '<span>',
'link_after' => '</span>',
'echo' => 0,
) );
$content .= $pagination;
return $content;
return $content;

add_filter( 'the_content', 'move_pagination', 1 );

Bad Syntax

Please be very aware – if you do copy and paste this code above, check the syntax as the formatting can get a little messed up, always check speech marks as this usually is what gets screwed up on copy and pasting from the internet.


If you have any questions or comments on this post, please feel free to either leave a comment below or use one of our many social media platforms.


Click to rate this post!
[Total: 1 Average: 5]

Free Subscription

If you want to be notified when we post more quality guides like this one, sign up to our free subscription service and you will receive an email when a new post is live.

Join 443 other subscribers.

No need to worry, we will not be filling your inbox with spam and you can unsubscribe anytime you like.

Leave us a message...

This site uses Akismet to reduce spam. Learn how your comment data is processed.