Make WordPress Core

Opened 16 years ago

Closed 12 years ago

Last modified 12 years ago

#6110 closed defect (bug) (wontfix)

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

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

Description

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 16 years ago.
Plugin file that contains the rewrite code.
6110.rewrite.diff (1.3 KB) - added by DD32 16 years ago.

Download all attachments as: .zip

Change History (26)

#1 @nerrad
16 years ago

  • Priority changed from normal to high

#2 @DD32
16 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.

@nerrad
16 years ago

Plugin file that contains the rewrite code.

#3 @nerrad
16 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

#4 @nerrad
16 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.

#5 @DD32
16 years ago

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

http://dd32.no-ip.com:8080/wordpress/series/test-series/

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:

series-taxonomy.php
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..

#6 @nerrad
16 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.

#7 @nerrad
16 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)?

#8 @DD32
16 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.

@DD32
16 years ago

#9 @DD32
16 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

#10 @nerrad
16 years ago

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

#11 @DD32
16 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?)

#12 @nerrad
16 years ago

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

#13 @nerrad
16 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).

#14 @nerrad
16 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...

#15 @docwhat
16 years ago

Here is another plugin that was affected: YADIS
http://svn.wp-plugins.org/yadis/tags/1.2.1/yadis.php

This is with Wordpress 2.5 released.

Ciao!

#16 @docwhat
16 years ago

  • Cc docwhat added

#17 @Denis-de-Bernardy
15 years ago

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

#18 @dd32
15 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.

#19 @ryan
14 years ago

  • Milestone changed from 2.9 to 3.0

#20 @dd32
14 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.

#21 @dd32
12 years ago

  • Owner dd32 deleted

#22 @wonderboymusic
12 years 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.

#23 @wonderboymusic
12 years ago

  • Milestone Future Release deleted

#24 @nerrad
12 years 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.