Make WordPress Core

Opened 6 years ago

Closed 20 months ago

Last modified 20 months ago

#6110 closed defect (bug) (wontfix)

Custom permalinks created from plugin hooking in to WP redirects don't work.

Reported by: nerrad Owned by:
Milestone: Priority: high
Severity: major Version: 2.5
Component: Permalinks Keywords:
Focuses: Cc:


This might be related to ticket #5995:

I've been testing the new version of my Organize Series Plugin which works fine in WP 2.3.x with the redirect hooks. However in 2.5 none of the plugin specific redirects work.

To be clearer:
In 2.3.x http://localhost/series/series-name would redirect properly to the "series" archive page.
After upgrading to 2.5 http://localhost/series/series-name returns 404 error.

I've tried regenning permalinks, but that doesn't fix the problem. Is there something that's changed with how plugins should be hooking into the permalink system in 2.5?

Attachments (2)

series-taxonomy.php.txt (32.3 KB) - added by nerrad 6 years ago.
Plugin file that contains the rewrite code.
6110.rewrite.diff (1.3 KB) - added by DD32 6 years ago.

Download all attachments as: .zip

Change History (26)

comment:1 nerrad6 years ago

  • Priority changed from normal to high

comment:2 DD326 years ago

Can you link to the plugin, Or provide some code of whats not working?

This code is still working for me: http://dd32.id.au/files/wordpress/test-rewrite.php But i admit some things in there dont use the WP API.

nerrad6 years ago

Plugin file that contains the rewrite code.

comment:3 nerrad6 years ago

See attached file DD32 that contains the code. Again, I have no problems with WP2.3.3 but for some reason I get problems with 2.5

comment:4 nerrad6 years ago

I should also say that without permalinks (i.e. the default http://path/index.php?param=) everything works as expected. But as soon as I flip to permalinks my series archive pages return 404 BUT all other pages and posts work as expected.

comment:5 DD326 years ago

Hm......... I cant reproduce the problem your having:


using the plugin from here: http://www.unfoldingneurons.com/2008/organize-series-20-beta-1-release

I'm using the Permalink structure: /%year%/%monthnum%/%day%/%postname%/ I can see if using something like /%category%/%postname%/ could cause a 404 maybe..

Feel free to contact me off list @ wordpress@… if you want me to try more things, or to know more about my environment.. BTW, I had to make a change to part of the code to suppress some errors:

Line 36:
From: if (array_key_exists('object_id', $spost)) {
To: if ( is_array($spost) && array_key_exists('object_id', $spost)) {

$spost was an Integer, which was throwing a Warning(If errors are turned on) Change it to:

if ( (is_array($spost) || is_object($spost) ) && array_key_exists('object_id', $spost)) {

if you accept an object there too..

comment:6 nerrad6 years ago

Thanks for the bugcatch - I just caught that myself this morning and used a different fix :)

Thanks for your offer to help to - I've sent off an email.

comment:7 nerrad6 years ago

A thought - maybe this could point in the right direction. Are there any changes to the core rewrite rule-sets (from 2.3.3 - 2.5) that "might" make one more greedy and thus snag my plugin redirect before it get's processed (my plugin redirect just appends to the redirect array)?

comment:8 DD326 years ago

It'd be due to the verbose page rules which were introduced.
Silly me didnt realise that i had a patch applied still which added the verbose page rules AFTER the hook that plugins add pages on.

I'll attach a patch of the change i had made, Its probably hanging around in a previous trac ticket somewhere too.

DD326 years ago

comment:9 DD326 years ago

A Work around is to add the plugins rules at the start of the array:

$rules = current rules
$rewrite = plugin generated rules
	return ( $rewrite + $rules );
rather than:
	return ( $rules + $rewrite );

But that requires WordPress to check those rules first, While not a problem specifically, a lot of plugins are setup to add rules to the end of the list, rather than the start

comment:10 nerrad6 years ago

I tried the workaround - it doesn't work. Stumped again. It's as if the 'rewrite_rules_array' filter isn't doing anything.

comment:11 DD326 years ago

it doesn't work. Stumped again

So am i then.. Hopefully someone else can help more, 'cos i'm stumpted.

(You did try re-generating the rules didnt you?)

comment:12 nerrad6 years ago

Yes I regenerated the rules and tried different tokens as well.

comment:13 nerrad6 years ago

Okay something strange just happened - it started working. So...it looks like the workaround DOES work. I've confirmed it. (might have been a cacheing thing with my browser or something).

comment:14 nerrad6 years ago

I still think this warrants attention for 2.5 however. Your patch would do the trick and prevent potential headaches for plugins that do redirects...

comment:15 docwhat6 years ago

Here is another plugin that was affected: YADIS

This is with Wordpress 2.5 released.


comment:16 docwhat6 years ago

  • Cc docwhat added

comment:17 Denis-de-Bernardy5 years ago

  • Component changed from General to Permalinks
  • Owner changed from anonymous to ryan

comment:18 dd325 years ago

Pretty sure this is.. well.. a wontfix ticket now.. However the patch does look useful (Add the greedy rules definately at the end of the rule list)

Could come undone by any plugins which add extra-hungry rules at the end of the list.. But they've been broken since the greedy rules were introduced.

comment:19 ryan4 years ago

  • Milestone changed from 2.9 to 3.0

comment:20 dd324 years ago

  • Milestone changed from 3.0 to Future Release
  • Owner changed from ryan to dd32
  • Status changed from new to reviewing

Moving to future release due to no traction.

Will review this after release.

comment:21 dd322 years ago

  • Owner dd32 deleted

comment:22 wonderboymusic20 months ago

  • Resolution set to wontfix
  • Status changed from reviewing to closed

"Moving to future release due to no traction." is 2 years old. Attached patch is 5 years old. Most of the commentary here is about plugins which may not even be active anymore. dd32 declared "wontfix" 3 years ago.

comment:23 wonderboymusic20 months ago

  • Milestone Future Release deleted

comment:24 nerrad20 months ago

agree with the ticket status change. Just piping in though that Organize Series is still very active ;)

Note: See TracTickets for help on using tickets.