Make WordPress Core

Opened 12 years ago

Closed 12 years ago

#21274 closed defect (bug) (fixed)

Broken link for next comment pages for page on front

Reported by: sirzooro's profile sirzooro Owned by: nacin's profile nacin
Milestone: 3.5 Priority: normal
Severity: normal Version: 3.4.1
Component: Rewrite Rules Keywords: has-patch commit
Focuses: Cc:

Description

Create page and configure WP do display it on front. Set Comments per page to some small value. Go to front page and add few comments - more than configured Comments per page, so WP will display only some of them and link leading to remaining ones (e.g. http://wp-beta.local/comment-page-1/#comments). This link does not work - when you click it, browser will be redirected to following url, but page contents does not change:

http://wp-beta.local/?url=%2Fcomment-page-1%2F&ref=http%3A%2F%2Fwp-beta.local%2F%3Furl%3D%252Fcomment-page-1%252F%26ref%3Dhttp%253A%252F%252Fwp-beta.local%252F#comments

Note: permalink format is set to /%postname%/

Attachments (1)

21274.patch (664 bytes) - added by SergeyBiryukov 12 years ago.

Download all attachments as: .zip

Change History (7)

#1 @SergeyBiryukov
12 years ago

  • Keywords reporter-feedback added; needs-patch removed

I can't reproduce this following the steps provided the description. The URL I get is http://trunk.wordpress/comment-page-1/#comments, and it works fine.

url and ref parameters don't look like WP query variables. Could you try with all plugins disabled?

#2 @sirzooro
12 years ago

OK, I retried to reproduce it, and this time I got a bit different result:

  • Fresh WP 3.4.1 install (no plugins, default theme);
  • set permalink format to /%postname%/, enabled breaking comments into pages and set it to 2, set default Sample page as Front page;
  • go to front page;
  • add 3 comments - after clicking Post Comment you will be redirected to 404 page, so use Back in browser;
  • refresh page and click on Older Comments link - you will go to /comment-page-1/#comments URL and see the 404 page.

WordPress was installed on Windows/Apache - this may be important here.

#3 @sirzooro
12 years ago

  • Keywords needs-patch added; reporter-feedback removed

#4 @SergeyBiryukov
12 years ago

  • Keywords has-patch added; needs-patch removed
  • Milestone changed from Awaiting Review to 3.5

Thanks, I can reproduce now as well.

The problem is that rewrite rules are not flushed when setting a page as a front page, so the corresponding code in generate_rewrite_rules() doesn't get executed:
http://core.trac.wordpress.org/browser/tags/3.4.1/wp-includes/rewrite.php#L1331

21274.patch fixes the issue by calling update_home_siteurl() to flush the rules:
http://core.trac.wordpress.org/browser/tags/3.4.1/wp-admin/includes/misc.php#L194

#5 @ryan
12 years ago

  • Keywords commit added

#6 @nacin
12 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [22301]:

Flush rewrite rules when page_on_front is updated. props SergeyBiryukov. fixes #21274.

Note: See TracTickets for help on using tickets.