Opened 11 years ago
Last modified 7 months ago
#32295 new defect (bug)
Pagination on preview/scheduled posts
| Reported by: |
|
Owned by: | |
|---|---|---|---|
| Milestone: | Future Release | Priority: | normal |
| Severity: | normal | Version: | 4.2.2 |
| Component: | Posts, Post Types | Keywords: | has-patch has-test-info needs-unit-tests |
| 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)
Change History (11)
#3
@
10 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.
This ticket was mentioned in PR #8839 on WordPress/wordpress-develop by @SirLouen.
8 months ago
#6
Refreshed solution provided in 32295-pagination.patch
Trac ticket: https://core.trac.wordpress.org/ticket/32295
#7
@
8 months ago
- Keywords has-test-info dev-feedback added; needs-testing removed
Combined Bug Reproduction and Patch Test Report
Description
✅ This report validates that the indicated patch works as expected.
Patch tested: https://patch-diff.githubusercontent.com/raw/WordPress/wordpress-develop/pull/8839.diff
Environment
- WordPress: 6.9-alpha-60093-src
- PHP: 8.2.28
- Server: nginx/1.27.5
- Database: mysqli (Server: 8.4.5 / Client: mysqlnd 8.2.28)
- Browser: Chrome 137.0.0.0
- OS: Windows 10/11
- Theme: Twenty Sixteen 3.5
- MU Plugins: None activated
- Plugins:
- Classic Editor 1.6.7
- Test Reports 1.2.0
Reproduction Steps
- First you need a non-block theme to reproduce this like 2016
- Create a post like this:
This is the first page <!--nextpage--> This is the second page <!--nextpage--> This is the third page <!--nextpage--> This is the fourth page
- Go to the post and check you can move through the paginated sections
- Schedule the post in the future
- Hit on preview
- 🐞 Check you can move through the pagination sections, it doesn't work.
Expected Results
- Pagination works on Preview with the Scheduled post.
Actual Results
- ✅ Issue resolved with patch.
Additional Notes
- @adamsilverstein this patch is ready to be shipped. Simple yet effective. Can go into 6.8.2 or 6.8.3 without troubles.
#8
follow-up:
↓ 9
@
8 months ago
Patch looks good. I've confirmed the before and after behavior as outlined in the testing instructions above. Do we need any automated tests for this change?
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');