Make WordPress Core

Opened 9 years ago

Last modified 4 weeks ago

#32295 new defect (bug)

Pagination on preview/scheduled posts

Reported by: jacklynjade's profile jacklyn.jade Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 4.2.2
Component: Posts, Post Types Keywords: has-patch needs-testing
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 8 years ago.
patch to add future to statuses that don't use permalink structure

Download all attachments as: .zip

Change History (6)

#1 @SergeyBiryukov
9 years ago

  • Component changed from General to Posts, Post Types

#2 @kitwestneat
9 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 9 years ago by kitwestneat (previous) (diff)

@kitwestneat
8 years ago

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

#3 @kitwestneat
8 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.

#4 @swissspidy
4 weeks ago

  • Keywords needs-testing added
  • Milestone set to Future Release

#5 @swissspidy
4 weeks ago

#60584 was marked as a duplicate.

Note: See TracTickets for help on using tickets.