Pagniation links with/without trailing slashes.#8591
Pagniation links with/without trailing slashes.#8591peterwilsoncc wants to merge 10 commits intoWordPress:trunkfrom
Conversation
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. |
212dd21 to
6c628cd
Compare
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the 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. |
34cf831 to
c9bfda4
Compare
c9bfda4 to
b6a01bf
Compare
1f2dd39 to
6f57e5b
Compare
| array( | ||
| 'taxonomy' => 'category', | ||
| 'name' => 'Categorized', | ||
| array( 'slug' => 'categorized' ), |
There was a problem hiding this comment.
Is this right? I think it is not read properly. I tried supplying array( 'slug' => 'foo-bar-baz' ) and it still has a slug of categorized since it was derived from the name. I think this is unnecessary:
| array( 'slug' => 'categorized' ), |
Otherwise, I've seen the slug being defined one level up, for example:
(Props Gemini for pointing this out.)
| array( 'foo=bar', 'foo=bar/' ), | ||
| array( 'foo=bar', 'foo=bar%2F' ), | ||
| array( 'foo=bar%2F', 'foo=bar' ), | ||
|
|
||
| array( 's=post', 's=post/' ), | ||
| array( 's=post', 's=post%2F' ), |
There was a problem hiding this comment.
How about a test case when there is no query string?
There was a problem hiding this comment.
How about a test case when there is no query string?
An empty query string gets dropped so the output is covered above.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
@peterwilsoncc thanks for working on this ticket! |
e262810 to
e6b6553
Compare
Co-authored-by: Weston Ruter <westonruter@gmail.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-Authored-By: westonruter <westonruter@git.wordpress.org>
d339b21 to
76fc55e
Compare
|
|
||
| // Append the format placeholder to the base URL. | ||
| $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%'; |
There was a problem hiding this comment.
This can be deleted since it is immediately overwritten, yes?
| $pagenum_link = trailingslashit( $url_parts[0] ) . '%_%'; |
There was a problem hiding this comment.
The suggestion didn't come through right in GitHub. I mean these lines can be removed:
wordpress-develop/src/wp-includes/general-template.php
Lines 4671 to 4673 in 76fc55e
| * Ensures sites not using trailing slashes get links in the form | ||
| * `/page/2` rather than `/page/2/`. On these sites, linking to the | ||
| * URL with a trailing slash will results in a 301 redirect from the | ||
| * incorrect URL to the correctly formattted one. This presents an |
There was a problem hiding this comment.
| * incorrect URL to the correctly formattted one. This presents an | |
| * incorrect URL to the correctly formatted one. This presents an |
| /* | ||
| * Ensures sites not using trailing slashes get links in the form | ||
| * `/page/2` rather than `/page/2/`. On these sites, linking to the | ||
| * URL with a trailing slash will results in a 301 redirect from the |
There was a problem hiding this comment.
| * URL with a trailing slash will results in a 301 redirect from the | |
| * URL with a trailing slash will result in a 301 redirect from the |
| while ( $processor->next_tag( 'A' ) ) { | ||
| ++$found_links; | ||
| $href = $processor->get_attribute( 'href' ); | ||
| $this->assertStringEndsNotWith( '/', $href, "Pagination links should end with a trailing slash, found: $href" ); |
There was a problem hiding this comment.
| $this->assertStringEndsNotWith( '/', $href, "Pagination links should end with a trailing slash, found: $href" ); | |
| $this->assertStringEndsNotWith( '/', $href, "Pagination links should not end with a trailing slash, found: $href" ); |
| * @dataProvider data_query_strings | ||
| * | ||
| * @param string $query_string Query string. | ||
| * @param string $unexpected Unexpected query string. |
There was a problem hiding this comment.
Unused param.
| * @param string $unexpected Unexpected query string. |
| * @dataProvider data_query_strings | ||
| * | ||
| * @param string $query_string Query string. | ||
| * @param string $unexpected Unexpected query string. |
There was a problem hiding this comment.
Unused.
| * @param string $unexpected Unexpected query string. |
Second pass at https://core.trac.wordpress.org/ticket/61393
This Pull Request is for code review only. Please keep all other discussion in the Trac ticket. Do not merge this Pull Request. See GitHub Pull Requests for Code Review in the Core Handbook for more details.