Make WordPress Core

Opened 7 years ago

Last modified 3 months ago

#20902 reopened defect (bug)

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

Reported by: arieputranto Owned by: chriscct7
Milestone: Awaiting Review Priority: normal
Severity: normal Version: 3.4
Component: Canonical Keywords: has-patch, needs-testing, early, bulk-reopened
Focuses: Cc:


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 (3)

20920.diff (2.4 KB) - added by kovshenin 7 years ago.
20902.1.diff (2.4 KB) - added by brandondove 5 years ago.
Updated patch for 4.1-alpha-30299
20902.patch (4.7 KB) - added by jubstuff 3 years ago.
Unit tests added

Download all attachments as: .zip

Change History (15)

#1 @dd32
7 years ago

  • Component changed from Permalinks to Rewrite Rules

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

#2 @dd32
7 years ago

  • Component changed from Rewrite Rules to Canonical

7 years ago

#3 @kovshenin
7 years 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].

5 years ago

Updated patch for 4.1-alpha-30299

#4 @brandondove
5 years ago

@davejesch, @jdangl, and I tested this at the ocwp meetup on 4.1-alpha-30299 and the patch didn't apply. We updated the patch and applied it. As @kovshenin said, it fixes all three scenarios.

This ticket was mentioned in Slack in #core by brandondove. View the logs.

5 years ago

This ticket was mentioned in Slack in #core by brandondove. View the logs.

5 years ago

#7 @dd32
5 years ago

  • Keywords needs-unit-tests added; dev-feedback removed

The patch still looks like it's the right direction to go in, although we should also add some unit tests for these new redirections, covering both has-posts and no-posts for authors.

#8 @chriscct7
3 years ago

  • Keywords early added

3 years ago

Unit tests added

#9 @jubstuff
3 years ago

  • Keywords needs-unit-tests removed

I tested the patch, it works for me.

I've added the unit tests, adding elements to the shared fixtures.


#10 @chriscct7
3 years ago

  • Owner set to chriscct7
  • Status changed from new to reviewing

#11 @iseulde
5 months ago

  • Milestone Awaiting Review deleted
  • Resolution set to wontfix
  • Status changed from reviewing to closed

This ticket has not seen any activity in over *two* years, so I'm closing it as "wontfix".

The ticket may lack decisiveness, may have become irrelevant, or may not have gathered enough interest.

If you think this ticket does deserve some attention again, feel free to reopen.

For bugs, it would be great if you could provide updated steps to reproduce against the latest version of WordPress (5.0.2 at the time of writing). Remember images or a video can be superior to explain a problem. At the very least, quickly test again to make sure the bug still exists.

If it’s an enhancement or feature, some extra motivation may help.

Thank you for your contributions to WordPress! <3

#12 @JeffPaul
3 months ago

  • Keywords bulk-reopened added
  • Milestone set to Awaiting Review
  • Resolution wontfix deleted
  • Status changed from closed to reopened

A decision was made to reopen tickets that were closed in the bulk edit that this ticket was affected by. This ticket is being placed back into the Awaiting Review milestone so it can be individually evaluated and verified to determine if it is still relevant/valid or reproducible.

Note: See TracTickets for help on using tickets.