[wp-trac] [WordPress Trac] #32295: Pagination on preview/scheduled posts

WordPress Trac noreply at wordpress.org
Tue Jul 14 16:24:38 UTC 2015


#32295: Pagination on preview/scheduled posts
-------------------------------+------------------------------
 Reporter:  jacklyn.jade       |       Owner:
     Type:  defect (bug)       |      Status:  new
 Priority:  normal             |   Milestone:  Awaiting Review
Component:  Posts, Post Types  |     Version:  4.2.2
 Severity:  normal             |  Resolution:
 Keywords:                     |     Focuses:
-------------------------------+------------------------------

Comment (by kitwestneat):

 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. A potential fix is to always use ?p=<post_id>,
 at least for scheduled multi-page posts.

 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');
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/32295#comment:2>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list