[wp-trac] [WordPress Trac] #19693: redirect_guess_404_permalink() can catch the wrong post types
WordPress Trac
wp-trac at lists.automattic.com
Sun May 6 21:43:48 UTC 2012
#19693: redirect_guess_404_permalink() can catch the wrong post types
------------------------------+-----------------------
Reporter: nacin | Owner: nacin
Type: defect (bug) | Status: reopened
Priority: normal | Milestone: 3.4
Component: Canonical | Version:
Severity: normal | Resolution:
Keywords: has-patch commit |
------------------------------+-----------------------
Comment (by jeremyfelt):
I understand the coexistence of public and !publicly_queryable. I think
that is why {{{redirect_guess_404_permalink()}}} needs both arguments.
When a guess occurs, the resulting redirect initiates a new
{{{parse_request()}}}, which will see the guessed {{{query_var}}}, which
is directly related to the {{{publicly_queryable}}} argument.
Using my internal post type of 'my-special-post-type', that I have
registered as {{{ 'public' => true, 'publicly_queryable' => false,
'rewrite' => true }}}, the following happens:
* '''mysite/post-name'''
* not found, initiates {{{redirect_guess_404_permalink()}}}
* '''mysite/my-special-post-type/post-name'''
* becomes the redirected URL after guess, which results in 404 because
{{{publicly_queryable}}} is false
* if {{{publicly_queryable}}} is set to true, this URL becomes valid.
With {{{ 'public' => true, 'publicly_queryable' => false, 'rewrite' =>
false }}}, I get:
* '''mysite/?my-special-post-type=post-name'''
* becomes the redirected URL after guess, which results in 404 because
{{{publicly_queryable}}} is false
* if {{{publicly_queryable}}} is set to true, this URL becomes valid.
[attachment:19693.3.diff] adds the argument {{{'publicly_queryable' =>
true}}} to the existing {{{'public' => true}}}, resulting in a 404 at
'''mysite/post-name''' - leaving out the incorrect guess.
Pages may need to be included separately, as that is a special case.
--
Ticket URL: <http://core.trac.wordpress.org/ticket/19693#comment:10>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list