[wp-hackers] $wp_rewrite->add_permstruct() vs. add_rewrite_rule()
Austin Matzko
if.website at gmail.com
Tue Dec 8 06:05:07 UTC 2009
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.
More information about the wp-hackers
mailing list