Repository navigation
Posts, Post Types: Fix pagination links for scheduled posts - #16255
ankit-addweb wants to merge 3 commits into
Conversation
The permalink of a scheduled post is a plain `?p=ID` URL, but `_wp_link_page()` appended the page number as a path, which produced a broken link such as `/?p=ID/2/` when pretty permalinks were enabled. Clicking page 2 in a preview of a scheduled post showed page 1 again. Add the `future` post status to the statuses that use the `page` query argument, like `draft` and `pending`. See #32295.
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. Core Committers: Use this line as a base for the props when committing in SVN: To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. Props Bot commandsYou can trigger Props Bot actions by commenting on this PR:
|
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Trac ticket: https://core.trac.wordpress.org/ticket/32295
What
Adds the
futurepost status to the statuses that get the page number as apagequery argument in_wp_link_page(), next todraftandpending. Adds PHPUnit tests.Why
The permalink of a scheduled post is a plain
?p=IDURL. With pretty permalinks enabled,_wp_link_page()appended the page number as a path, producing a broken link such as/?p=4/2/. In a preview of a scheduled post, clicking "Page 2" showed page 1 again.This is the same one-word change as #8839 (by @SirLouen, refreshed from the patch by @kitwestneat). That PR was tested on the ticket by @SirLouen and @mindctrl, who asked for automated tests. This PR adds them. It can be merged with #8839 or replace it, whichever is simpler for reviewers.
Tests
Adds
test_subpage_url_with_pretty_permalinkstoTests_Post_wpLinkPageswith pretty permalinks enabled, for the draft, pending, scheduled and published statuses:?p=ID&page=2);Without the change, the scheduled case fails with
/?p=4/2/. With it, all tests inTests_Post_wpLinkPagespass, as do thepostandtemplategroups.I did not check other statuses, such as
private, and kept the change to the one in the ticket.How to test
<!--nextpage-->(for example Twenty Sixteen) and enable pretty permalinks.<!--nextpage-->sections and schedule it for a future date.npm run test:php -- --filter Tests_Post_wpLinkPages