#11694 closed defect (bug) (fixed)
WP should do sanity checks for paginated posts, pages and comments
Reported by: | Denis-de-Bernardy | Owned by: | wonderboymusic |
---|---|---|---|
Milestone: | 4.4 | Priority: | normal |
Severity: | major | Version: | 2.9 |
Component: | Posts, Post Types | Keywords: | has-patch 3.9-early |
Focuses: | template | Cc: |
Description
Create a post with two pages using the <!--nextpage--> tag. Publish, and browse the post's *third* page.
WP should return a 404 here, rather than the last page of the post.
Along the same lines, it should return the correct canonical urls for paginated posts. Currently, rel=canonical will only ever return the post's first page.
Attachments (7)
Change History (53)
#2
@
15 years ago
- Summary changed from WP should do sanity check for paginated posts and pages to WP should do sanity checks for paginated posts and pages
#4
@
15 years ago
- Keywords has-patch added
- Milestone changed from 3.0 to 3.1
- Owner set to dd32
- Status changed from new to accepted
I'm attaching a patch I've got locally for this.
This will need a more thought out patch however.
#6
@
12 years ago
Closed #21278 as a duplicate. Related: #11857 (for archive pages).
As noted in ticket:21278:9, paginated comments are affected too.
#8
@
12 years ago
See also #21579 where a similar issue occurs with paged comments. Invalid comment pages, for example http://example.com/content/comment-page-999/ do not return a 404 but equally do not find any comments! Is a new ticket needed or can we use this one to fix the 404 issue in both cases and #21579 to generate the proper rel="canonical" in both cases?
#9
@
12 years ago
- Summary changed from WP should do sanity checks for paginated posts and pages to WP should do sanity checks for paginated posts, pages and comments
Replying to mdgl:
Is a new ticket needed or can we use this one to fix the 404 issue in both cases
No need for a new ticket. Updated the summary.
#10
@
11 years ago
See also #18660
@elky was correct 3 years ago, this is two issues.
1) site/post/## - where ## is non-existant - should 404 or 301 not 200 duplicate content
2) site/post/## - where ## > 1 - rel=canonical should be site/post/## not duplicate first page site/post based on :
http://support.google.com/webmasters/bin/answer.py?hl=en&answer=1663744
"rel="next" and rel="prev" are orthogonal concepts to rel="canonical". You can include both declarations."
#11
@
11 years ago
The patch I just added fixes point 1 in @here's comment above: ie. the fact that WP serves a 200 for a page that doesn't exist by, if the post is paginated, checking how much pages are in the post and acting accordingly, by either redirecting to the first page of the post or by providing a proper URL.
#12
@
11 years ago
This second patch adds the page query variable to the canonical. If it's not used in conjunction with the other patch, this should check whether this page can actually exist.
#13
@
11 years ago
Looking at how it's dealt with in post-template.php a bit more, this probably should actually be done a bit different. I think _wp_link_page
should be split up and part of that should be in link-template.php, which should then be used by _wp_link_page and the functions above...
#14
@
11 years ago
The last ticket introduces get_paginated_post_url
, for which the functionality is removed from _wp_link_page
and now used in both _wp_link_page
in post-template.php and rel_canonical
in link-template.php. This looks a lot cleaner to me than what we had so far and also allows for future use of get_paginated_post_url
within a patch for #18660.
#15
@
11 years ago
#3 changes get_paginated_post_link
into the semantically correct name get_paginated_post_url
.
#23
@
11 years ago
- Keywords 3.9-early added
- Milestone changed from 3.8 to Future Release
There is some cool work from joostdevalk here, but it's too late for 3.8. Maybe we can tackle the messiness of pagination in 3.9.
This ticket was mentioned in IRC in #wordpress-dev by helen. View the logs.
10 years ago
This ticket was mentioned in IRC in #wordpress-dev by SergeyBiryukov. View the logs.
10 years ago
#30
@
9 years ago
- Milestone changed from Future Release to 4.4
I found an amazingly awesome bug in Rewrite - makes it where get_query_var( 'page' )
returns /4
.... no problem, let's just cast to (int)
.... what's that you say? The cast results in 0
?!?!?
See 11694.2.diff
This ticket was mentioned in Slack in #core by wonderboymusic. View the logs.
9 years ago
#36
@
9 years ago
The only remaining piece is redirecting out-of-bounds comment pages - which can be tackled once we finish ripping apart WP_Comment_Query
in #8071
#37
@
9 years ago
- Resolution set to fixed
- Status changed from assigned to closed
Closing as fixed because #11248 is the last piece.
#39
follow-up:
↓ 40
@
9 years ago
Changing rewrite regex means anyone filtering rewrite_rules
will experience unexpected behavior with this change.
#40
in reply to:
↑ 39
;
follow-up:
↓ 41
@
9 years ago
Replying to danielbachhuber:
Changing rewrite regex means anyone filtering
rewrite_rules
will experience unexpected behavior with this change.
what's your point? you want to keep the bugs?
#41
in reply to:
↑ 40
@
9 years ago
Replying to wonderboymusic:
what's your point? you want to keep the bugs?
My comment was observational, not inflammatory. Just noting that r34492 breaks backwards compatibility in the manner I specified. I've had to update WP-CLI's test accordingly.
The rel=canonical issue really ought to be split out in to a separate bug, imho.