Make WordPress Core

Opened 15 years ago

Closed 15 years ago

Last modified 15 years ago

#13156 closed defect (bug) (invalid)

Permalinks problem with 4-digits ID

Reported by: sashobg's profile sashobg Owned by: ryan's profile ryan
Milestone: Priority: normal
Severity: normal Version: 2.9.2
Component: Permalinks Keywords: permalinks
Focuses: Cc:

Description

Hi,
I'm trying to change address of the type: http://www.domain.com/post_id with address of the type: http://www.domain.com/2010/04/sample-post/

When I do that change, I wanna use the popular Permalinks Migration Plugin, which would redirect visitors from the old to the new address.

But that's the problem: the plugin works perfectly with all posts, which have IDs of the type XX, XXX, XXXXX, but not with posts of the type XXXX - that is, 4-digit posts can't be redirected to the new address and I get a 404 error.

At the same time, I have a heavy database query, and for that reason I've reverted to the old variant, until the problem's solved.

To be concrete, here's an example:

http://testing2.slusham.com/31310 - it works, http://testing2.slusham.com/174 - it works, while

http://testing2.slusham.com/2775 , http://testing2.slusham.com/4525 and any other 4-digit posts do not work.

I've also tried the plugin Permalinks moved permanently, but it fails just in the same manner.

Change History (5)

#1 follow-up: @nacin
15 years ago

WP realistically has no way of identifying that what it thinks is a year was actually once a post ID.

You'd have to hook in real early and perform the redirection or set the query vars yourself.

#2 in reply to: ↑ 1 ; follow-up: @sashobg
15 years ago

Replying to nacin:

WP realistically has no way of identifying that what it thinks is a year was actually once a post ID.

You'd have to hook in real early and perform the redirection or set the query vars yourself.

Hi nacin, thanks for the reply. As I'm getting no reply in the forum, could you please just give me an example - how could I "hook in real early" (I guess I should set the redirection command in a given Wordpress file), and what do you mean by "setting the query vars myself" - as I'm using the panel to set the permalinks, but to no result.

Could you just please give me example - which file would I have to edit?

#3 in reply to: ↑ 2 @sashobg
15 years ago

Replying to sashobg:

Replying to nacin:

WP realistically has no way of identifying that what it thinks is a year was actually once a post ID.

You'd have to hook in real early and perform the redirection or set the query vars yourself.

Hi nacin, thanks for the reply. As I'm getting no reply in the forum, could you please just give me an example - how could I "hook in real early" (I guess I should set the redirection command in a given Wordpress file), and what do you mean by "setting the query vars myself" - as I'm using the panel to set the permalinks, but to no result.

Could you just please give me example - which file would I have to edit?

And one more thing - if I use the structure /%postname%/%post_id%/ - it works, but then I get 404 on pages (not posts), which are usually www.domain.com/anything-here ?

#4 follow-up: @nacin
15 years ago

  • Resolution set to invalid
  • Status changed from new to closed

Sorry, this isn't a support forum. There are many ways to do this. You can create a plugin that hooks into query, canonical, template_redirect, or even rewrite, to achieve what you're trying to achieve.

#5 in reply to: ↑ 4 @sashobg
15 years ago

Thanks a lot. I'll try and get some help.

Note: See TracTickets for help on using tickets.