WordPress.org

Make WordPress Core

Opened 12 months ago

Last modified 8 months ago

#20902 new defect (bug)

redirect_canonical() on using permalink: Not all $_GET being redirected

Reported by: arieputranto Owned by:
Priority: normal Milestone: Awaiting Review
Component: Canonical Version: 3.4
Severity: normal Keywords: has-patch needs-testing dev-feedback
Cc:

Description

Using permalink, I suppose that all query_var entered manually on URL or using $_GET will be redirected to proper permalink. Apparently not all being redirected at all. AFAIC:

  1. /?post_format=image : should be redirected to /type/image/
  2. /?pagename=blog : should be redirected to /blog/
  3. /?author_name=admin : should be redirected to /author/admin/

Unfortunately, they are not.

It can be done by filtering redirect_canonical() but it will be better if it's being done by default as we can see that /?category_name=cat will be redirected to /category/cat/

Attachments (1)

20920.diff (2.4 KB) - added by kovshenin 8 months ago.

Download all attachments as: .zip

Change History (4)

comment:1 dd328 months ago

  • Component changed from Permalinks to Rewrite Rules

Confirmed all 3 issues are still current, There are existing tickets for 2 & 3 I believe.

comment:2 dd328 months ago

  • Component changed from Rewrite Rules to Canonical

kovshenin8 months ago

comment:3 kovshenin8 months ago

  • Keywords has-patch needs-testing dev-feedback added; needs-patch removed

20920.diff fixes all three scenarios, mainly by adding logic to canonical.php. As for the post format canonical redirects, the current tax query redirects seems to handle tags, categories and custom taxonomy well, but the extra post_type query argument added in _post_format_request prevented it from doing so.

I feel weird that categories, tags and custom post types won't append the post_type argument, even if added to other object types with register_taxonomy_for_object_type, so I don't understand the reason why it's there for post formats, since post formats is a taxonomy, just like everything else, except that it has a custom admin interface. Would like feedback on this from Andrew and/or Mark, see [17249].

Note: See TracTickets for help on using tickets.