[wp-hackers] $wp_rewrite->add_permstruct() vs. add_rewrite_rule()

Mike Schinkel mikeschinkel at newclarity.net
Tue Dec 8 06:12:46 UTC 2009


On Dec 8, 2009, at 1:05 AM, Austin Matzko wrote:
> On Mon, Dec 7, 2009 at 11:50 PM, Mike Schinkel
> <mikeschinkel at newclarity.net> wrote:
>> So I've been trying to figure out $wp_rewrite->add_permstruct() vs. add_rewrite_rule() for the past several days. I've been able to get the former to work but not the latter.  I'm trying to figure out when we would use one and when we would use the other?
>> 
>> It *seems* like using add_permastruct() can get you support or things like custom single_template and that add_rewrite_rule() would require use of template_redirect, but I can't be 100% sure?
> 
> I think it boils down to this: add_rewrite_rule() lets you set very
> particular rewrite rules: you must specify exactly what you want those
> rules to be.
> 
> In contrast, whatever you pass to add_permastruct() is just a base
> from which WordPress adds a bunch of other stuff, possibly defined by
> other plugins, such as pagination rules, endpoints, and the like.

Thanks. I think I'm starting to get my head around it.

-Mike



More information about the wp-hackers mailing list