[wp-hackers] Filter: rewrite_rules_array

DD32 wordpress at dd32.id.au
Fri Jun 6 01:23:49 GMT 2008


On Fri, 06 Jun 2008 06:07:14 +1000, Jason Webster <jason at intraffic.net>  
wrote:

> Ok, thanks again for the help :)
>
> There is one other thing I don't really understand...
> Could you explain the precedence of the rewrite rules? I would image
> that they would be ascending, so rules added last are checked first, but
> that doesn't seem to be the case.
>
> For example, while running your test plugin, it doesn't catch any of the
> artist rules, it just assigns "artist" to the pagename query var.

Oh.. Damn, I havnt updated the plugin example since WordPRess 2.5 was  
releasd, The final queries are greedy and match everything.. Need to add  
them either at the start, or just before the Page queries.

As for precidence, Its whatever is first in the array that matches, Look  
at the rewrite_rules option: print_r(get_option('rewrite_rules')); and  
you'll see the order in which they match

> So, what I am doing wrong? Is the permalink structure in the Settings
> page overriding the rewrite rules? Because that's what it seems like.
>
> Thanks in advance!
>
> DD32 wrote:
>> The filter would only be fired when the rules are regenerated.
>>
>> See the last function in this:
>> http://dd32.id.au/files/wordpress/test-rewrite.php
>>
>> On Thu, 05 Jun 2008 15:18:27 +1000, Jason Webster
>> <jason at intraffic.net> wrote:
>>
>>> Hi all,
>>> I apologize in advance if this has been covered before, or somewhere
>>> else.
>>>
>>> I believe I'm missing something very simple here, because I can't seem
>>> to make the rewrite_rules_array filter do... well anything.
>>> I've even tried just throwing a "die" in the function that the filter
>>> points too... nothing. It's not the add_filter call, because if I set  
>>> it
>>> to any other filter, it works fine.
>>>
>>> I'll probably have a embarrassing, forehead slap moment briefly after
>>> sending this email, but in the mean time: Any suggestions?
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>>
>
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>




More information about the wp-hackers mailing list