Making WordPress.org

Opened 2 years ago

Last modified 2 years ago

#6531 new defect (bug)

Error in pagination in plugin results, loading different query

Reported by: alvarogois's profile alvarogois Owned by:
Milestone: Priority: normal
Component: Plugin Directory Keywords:
Cc:

Description

I did a search for "feed" tag in plugins directory. Got this result:

https://wordpress.org/plugins/tags/feed/https://wordpress.org/plugins/tags/feed/

Pagination shows 18 pages. When I click the Next link or the 2 link, I get this totally different query:

https://wordpress.org/plugins/search/page/

I should, in fact, get here:

https://wordpress.org/plugins/tags/feed/page/2/, right?

If I execute the same kind of search but with the tag "post", it seems to be OK. I can use pagination to navigate to page 2 of results.

I tried this in Chrome (logged-in) and Firefox (not logged-in). Also, in Firefox there seems to be some issue loading site files, a lot of content is not visible (menus, text, etc.): https://tinyurl.com/2m9lmlon.

Thanks.

Change History (3)

#1 @Otto42
2 years ago

Basically, the feed url conflicts with some of our predefined url patterns.

Suggest we eliminate those as possible tags.

#2 @dd32
2 years ago

Does this happen to regular WordPress tag archives for the term feed? Or is it specific to WordPress.org?

#3 @dd32
2 years ago

I can confirm that this isn't coming from WordPress.org code, it appears to be a bug in Core's Canonical.

https://core.trac.wordpress.org/browser/trunk/src/wp-includes/canonical.php?rev=53043&marks=430,437,443#L427

Filed an upstream issue: https://core.trac.wordpress.org/ticket/56937

Thank you for bringing this up @alvarogois.

We could patch around this on the plugin directory, this works as expected for me:
(Per upstream tickets, and past meta tickets, this also affects the rss tag and a few others, so this is not a complete solution)

// Make paginated versions of /tags/feed accessible. #core56937
add_filter( 'redirect_canonical', function( $redirect_url, $requested_url ) {
	if (
		str_contains( $requested_url, '/tags/feed/' ) &&
		! str_contains( $redirect_url, '/tags/feed/' )
	) {
		$redirect_url = str_replace( '/tags/', '/tags/feed/', $redirect_url );
	}

	return $redirect_url;
}, 1, 2 );
Last edited 2 years ago by dd32 (previous) (diff)
Note: See TracTickets for help on using tickets.