Insert pagination links – wp_link_pages() – before filters on posts

I’m trying to add pagination support for some longer posts on my site. I’ve added the wp_link_pages() function to my single.php file, after the_content, but this causes the pagination links to display under some end-of-post plugins I have (YARPP and Better Author Bio, if that matters).

I’d like the pagination links to appear at the end of the actual content, before any filter hooks are added. How can I do this without editing the the get_the_content function in wp-includes/post-template.php? Do I need to write a plugin?

Related posts

Leave a Reply

1 comment

  1. That’s because you have directly edited the single.php file, try to make a function and in it return wp_link_pages() and in add_action set a priority. Try this function

    function pagination_after_post()
    {
     return wp_link_pages();
    }
    
    add_action('the_content','pagination_after_post',1);
    

    My WP PHP is not that good, my function might be wrong, this is just an example, but this way you can get pagination exactly after post