How to get complete content for a single post that was splitted into pages

I have a WordPress post which was divided into multiple pages using pager break <!--nextpage--> tag and it’s pagination functionality is working as expected for single post page.

www.example.com/url-post-content/1
www.example.com/url-post-content/2
www.example.com/url-post-content/3

But problem is my category page where i am showing all posts for a category with pagination(single post on each page).

Read More

I want to show complete content of the post(without pagination) on my category post page because here i am showing single post per page for the category but the_content function in my loop returning content of only first page for a post which was divided into pages using <!--nextpage--> tag.

Need you help to find out a way for displaying complete content of a post which was splitted in pages using page break tag.

Related posts

Leave a Reply

1 comment

  1. You can get complete content of post using code below.

    Retrieves post data using get_post function.

    $post_object = get_post($post_id); //     
    /// Now, you have post object and can get complete post content from post object
    $post_content = $post_object->post_content;
    

    use do_shortcode or apply_filters to properly format your post content.

    echo do_shortcode($post_content);