WordPress.org

Make WordPress Core

Opened 20 months ago

Last modified 7 months 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: has-patch needs-testing
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 19 months ago.
21700.diff (1.2 KB) - added by wonderboymusic 9 months ago.
tests.21700.1.diff (1.3 KB) - added by atimmer 8 months ago.
tests.21700.2.diff (1.4 KB) - added by atimmer 7 months ago.

Download all attachments as: .zip

Change History (19)

comment:1 SergeyBiryukov20 months 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).

comment:2 SergeyBiryukov20 months 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' );

comment:3 xavivars20 months 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?

comment:4 SergeyBiryukov20 months 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/

comment:5 SergeyBiryukov20 months ago

  • Keywords needs-unit-tests added

comment:7 wonderboymusic19 months 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.

comment:8 wonderboymusic16 months ago

  • Milestone changed from Awaiting Review to 3.6

comment:9 ryan11 months ago

  • Milestone changed from 3.6 to Future Release

wonderboymusic9 months ago

comment:10 wonderboymusic9 months 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

atimmer8 months ago

comment:11 atimmer8 months 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.

comment:12 atimmer8 months ago

  • Cc atimmermans@… added

comment:13 follow-up: duck_8 months 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.

atimmer7 months ago

comment:14 atimmer7 months ago

tests.21700.2.diff adds the test duck_ suggested.

comment:15 in reply to: ↑ 13 nacin7 months 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.

Note: See TracTickets for help on using tickets.