WordPress.org

Make WordPress Core

Opened 3 years ago

Last modified 2 years ago

#32295 new defect (bug)

Pagination on preview/scheduled posts

Reported by: jacklyn.jade Owned by:
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 4.2.2
Component: Posts, Post Types Keywords: has-patch
Focuses: Cc:

Description

The option to add a NextPage (Pagination) is not functioning in page previews or when a post/page is scheduled to be published.

<!--nextpage-->

The expected outcome is when adding the code for nextpage, you get links to Page 1, 2, etc. and when you click those links, you are taken to more content.

However, when a page/post is not PUBLISHED but is in Preview or Scheduled, the Pagination does not function as expected. Clicking on Page 2 refreshes the page and shows the content on page 1 again.

When the page is published, everything works as expected, but for someone who is trying to preview their post before publishing, this is not helpful.

Attachments (1)

32295-pagination.patch (775 bytes) - added by kitwestneat 2 years ago.
patch to add future to statuses that don't use permalink structure

Download all attachments as: .zip

Change History (4)

#1 @SergeyBiryukov
3 years ago

  • Component changed from General to Posts, Post Types

#2 @kitwestneat
3 years ago

We are hitting this as well. The issue seems to be that when you hit "view post" on a scheduled post it uses the permalink, but if you hit preview it uses the ?p=<post_id> link, and wp_link_pages gets confused about how to correctly create the link. (It does /?p=52248/2). A potential fix is to always use ?p=<post_id>, at least for scheduled multi-page posts, and so the previous link becomes ?p=52248&page=2

Here is a simple patch that more or less does that change:

diff -r 6e6286aee493 wordpress/wp-includes/post-template.php
--- a/wordpress/wp-includes/post-template.php   Tue Jul 14 03:32:12 2015 -0400
+++ b/wordpress/wp-includes/post-template.php   Tue Jul 14 12:23:15 2015 -0400
@@ -887,7 +887,7 @@
        if ( 1 == $i ) {
                $url = get_permalink();
        } else {
-               if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending')) )
+               if ( '' == get_option('permalink_structure') || in_array($post->post_status, array('draft', 'pending', 'future')) )
                        $url = add_query_arg( 'page', $i, get_permalink() );
                elseif ( 'page' == get_option('show_on_front') && get_option('page_on_front') == $post->ID )
                        $url = trailingslashit(get_permalink()) . user_trailingslashit("$wp_rewrite->pagination_base/" . $i, 'single_paged');
Last edited 3 years ago by kitwestneat (previous) (diff)

@kitwestneat
2 years ago

patch to add future to statuses that don't use permalink structure

#3 @kitwestneat
2 years ago

  • Keywords has-patch added

We're still hitting this bug - what's the best way to get traction on solving it? I updated the patch against the latest release, and uploaded it. Let me know if there's anything else I can do to help move the process along.

Note: See TracTickets for help on using tickets.