#20374 closed defect (bug) (fixed)

Unit Test failure: ?pagename=actually-a-post-name redirect

Reported by: markjaquith Owned by: markjaquith
Priority: normal Milestone: 3.4
Component: Canonical Version:
Severity: normal Keywords:
Cc:

Description

The unit test for canonical redirection of ?pagename=actually-a-post-name is failing.

We find the post, but we're failing to strip the ?pagename=slug part.

Attachments (1)

20374.diff (630 bytes) - added by markjaquith 14 months ago.
strip some common parameters that we do not need if we have an actual URL.

Download all attachments as: .zip

Change History (6)

strip some common parameters that we do not need if we have an actual URL.

  • Milestone changed from Future Release to 3.4
  • Owner set to markjaquith
  • Status changed from new to accepted

This is actually pretty nasty in the case of ?name=incomplete-slug, as it will redirect to /2012/04/incomplete-slug-for-post/?name=incomplete-slug and result in a 404.

  • Resolution set to fixed
  • Status changed from accepted to closed

In [20380]:

Strip p, page_id, attachment_id, post_type, pagename, and name from redirect query if we get a hit on a 404-guessed permalink. fixes #20374

In [20386]:

Be a bit more conservative in which args are stripped after redirect_guess_404_permalink().

  • Resolution fixed deleted
  • Status changed from closed to reopened

I think this can break a valid URL to a post. Well, specifically, non-post posts.

get_post_permalink() is used to generate links to items of custom post types. A post type's ugly link is in the form of ?post_type=$post_type&p=1234.

This should be reproducible even with pretty permalinks enabled on the site. Setting public = true, query_var = false, rewrite = false should do it.

  • Resolution set to fixed
  • Status changed from reopened to closed

In [20395]:

Better removal of query args in canonical redirects. Only remove them when they are not present in the redirect_url. fixes #20374

Note: See TracTickets for help on using tickets.