WordPress.org

Make WordPress Core

Opened 6 years ago

Last modified 3 years ago

#21700 new defect (bug)

Problem obtaining the Feed of an archive of tag “RSS”

Reported by: xavivars Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version: 3.4.1
Component: Canonical Keywords: needs-testing needs-patch
Focuses: Cc:

Description

I'm using RSS as a tag for some of my blog posts, and I was using them without any problem.

myblog.com/tag/rss/

But I've just realised that Google Webmaster Tools gives me some related errors.

The issue is this: when trying to retrieve the feed of this tag, from

myblog.com/tag/rss/feed/

it gets redirected to

myblog.com/tag/feed/

And this gives an error.

Attachments (4)

allow-feedmatching-query-vars.diff (1.3 KB) - added by wonderboymusic 6 years ago.
21700.diff (1.2 KB) - added by wonderboymusic 5 years ago.
tests.21700.1.diff (1.3 KB) - added by atimmer 5 years ago.
tests.21700.2.diff (1.4 KB) - added by atimmer 5 years ago.

Download all attachments as: .zip

Change History (20)

#1 @SergeyBiryukov
6 years ago

  • Component changed from Rewrite Rules to Canonical

Same for "feed", "rss2", "rdf", and "atom" tags.

Caused by stripping feed endings in redirect_canonical():
http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/canonical.php#L221

Related: [9697] (for #8076), [10505] (for #8642).

#2 @SergeyBiryukov
6 years ago

A workaround is to disable canonical redirection for tag feeds:

function disable_canonical_redirection_for_tag_feeds() {
	if ( is_feed() && is_tag() )
		remove_action( 'template_redirect', 'redirect_canonical' );
}
add_action( 'wp', 'disable_canonical_redirection_for_tag_feeds' );

#3 @xavivars
6 years ago

Thanks for the workaroud.

Do you know how is the process to fix this bug? It's the first time I submit one, and I'm not sure how does it work.

I mean, a developer has to assign the ticket to himself?

#4 @SergeyBiryukov
6 years ago

Not necessarily, anyone can write a patch.

However, the issue seems tricky and will require unit test coverage:
http://make.wordpress.org/core/handbook/automated-testing/

#5 @SergeyBiryukov
6 years ago

  • Keywords needs-unit-tests added

#7 @wonderboymusic
6 years ago

  • Keywords has-patch needs-testing added; needs-patch removed

This is not just tags / tax, it's any query var that matches a feed slug, my patch addresses them. Attached.

#8 @wonderboymusic
6 years ago

  • Milestone changed from Awaiting Review to 3.6

#9 @ryan
5 years ago

  • Milestone changed from 3.6 to Future Release

@wonderboymusic
5 years ago

#10 @wonderboymusic
5 years ago

  • Milestone changed from Future Release to 3.7

It seems that/tag/rss/feed/ works now in trunk, but /tag/rss/feed breaks on redirection. My patch is refreshed, makes /tag/rss/feed redirect to /tag/rss/feed/ properly

#11 @atimmer
5 years ago

test.21700.1.diff adds 4 tests for using tag's with the same name as feed names. hmm, wondering if it needs a test with custom feed names too.

The tests indicate that the comment of wonderboymusic is correct. His patch doesn't fix the tests though.

#12 @atimmer
5 years ago

  • Cc atimmermans@… added

#13 follow-up: @duck_
5 years ago

Unfortunately the problem is more extensive so the current patch isn't enough. This is because stripping occurs for more than just feeds. For example, /tag/rss/page/2/ becomes /tag/page/2/ with and without the patch.

#14 @atimmer
5 years ago

tests.21700.2.diff adds the test duck_ suggested.

#15 in reply to: ↑ 13 @nacin
5 years ago

  • Keywords needs-unit-tests removed
  • Milestone changed from 3.7 to Future Release

Replying to duck_:

Unfortunately the problem is more extensive so the current patch isn't enough. This is because stripping occurs for more than just feeds. For example, /tag/rss/page/2/ becomes /tag/page/2/ with and without the patch.

#16 @chriscct7
3 years ago

  • Keywords needs-patch added; has-patch removed
Note: See TracTickets for help on using tickets.