WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 years ago

#35189 closed defect (bug) (duplicate)

Redirection based on _wp_old_slug postmeta value should first check if there is an active published post with the same slug!

Reported by: gnotaras Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.4
Component: Query Keywords:
Focuses: Cc:

Description

I happened to find a published post (postA) being permanently redirected to another post (postB).

After doing some research I found out that postB had a postmeta key _wp_old_slug equal to the slug of postA. When I deleted that particular postmeta key/value from the database, everything returned back to normal (no redirection).

This must have started happening lately (during the last months).

Shouldn't it be checked whether there is an active published post with a slug equal to the value of a _wp_old_slug key before performing the actual redirection?

I really have no clue how this postmeta key had been created there in the past. The point is that such a redirection started happening lately and that the way it is done without doing any checks could lead to problems.

Please fix it. Thanks in advance!

Change History (4)

#1 @gnotaras
4 years ago

Also it might be a good idea to never let WP perform permanent redirections by itself, unless it can create a report of such redirections in some way.

#2 @SergeyBiryukov
4 years ago

  • Component changed from General to Query
  • Milestone Awaiting Review deleted
  • Resolution set to duplicate
  • Status changed from new to closed

Hi @gnotaras,

Thanks for the report, we're already tracking this issue in #35031.

#3 @gnotaras
4 years ago

Hello Sergey,

Thanks for marking it as duplicate. I had not noticed the other ticket.

BTW, I cannot reproduce this behavior in 4.5-alpha-36033.

Kind Regards,
George

#4 @bronsonquick
4 years ago

#35298 was marked as a duplicate.

Note: See TracTickets for help on using tickets.