[wp-trac] [WordPress Trac] #45687: URL params get lost because of canonical redirect on static front page
WordPress Trac
noreply at wordpress.org
Tue Dec 18 12:24:43 UTC 2018
#45687: URL params get lost because of canonical redirect on static front page
---------------------------+------------------------------
Reporter: captain.crash | Owner: (none)
Type: defect (bug) | Status: assigned
Priority: normal | Milestone: Awaiting Review
Component: Canonical | Version: 5.0.1
Severity: minor | Resolution:
Keywords: needs-patch | Focuses:
---------------------------+------------------------------
Description changed by SergeyBiryukov:
Old description:
> Please see #25143.
>
> A shortcode that changes its output via (prettified) URL params, i.e.
> `/test/1/`.
>
> Use the shortcode on a **static front page**.
>
> The params are added either with `add_rewrite_rule()` or
> `add_rewrite_endpoint()`, but **without adding query vars**.
> This is basically what the patch in #25143 fixed (3rd param ''false''):
>
> {{{
> add_rewrite_endpoint( 'test', EP_PERMALINK | EP_ROOT | EP_PAGES, false );
> }}}
>
> However, the later change on line 175 in
> [https://build.trac.wordpress.org/changeset/36204/trunk/wp-
> includes/canonical.php changeset 36204] causes a request such as
> `/test/1/` to redirect to `/` **and the shortcode can't work with the
> param**.
>
> On a side note, adding the params as query vars causes the intended
> static front page to use the posts template because `is_home()` is
> ''true''.\\
> I understand that if I don't want URL params to modify the query, I
> should not register them as query vars (see [ticket:25143#comment:21
> boonebgorges]). However, the template change feels rather wrong to me,
> too (see [ticket:25143#comment:20 mordauk]).
>
> Thanks for listening.
New description:
Please see #25143.
A shortcode that changes its output via (prettified) URL params, i.e.
`/test/1/`.
Use the shortcode on a **static front page**.
The params are added either with `add_rewrite_rule()` or
`add_rewrite_endpoint()`, but **without adding query vars**.
This is basically what the patch in #25143 fixed (3rd param ''false''):
{{{
add_rewrite_endpoint( 'test', EP_PERMALINK | EP_ROOT | EP_PAGES, false );
}}}
However, the later change on line 175 in changeset [36237] causes a
request such as `/test/1/` to redirect to `/` **and the shortcode can't
work with the param**.
On a side note, adding the params as query vars causes the intended static
front page to use the posts template because `is_home()` is ''true''.\\
I understand that if I don't want URL params to modify the query, I should
not register them as query vars (see [ticket:25143#comment:21
boonebgorges]). However, the template change feels rather wrong to me, too
(see [ticket:25143#comment:20 mordauk]).
Thanks for listening.
--
--
Ticket URL: <https://core.trac.wordpress.org/ticket/45687#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list