[wp-hackers] the right hook for custom content

Jennifer Hodgdon yahgrp at poplarware.com
Tue Mar 17 14:50:48 GMT 2009


You only need to flush rewrite rules if you are using one of the 
actions/filters that creates new rewrite rules. The reason for 
flushing is that the rewrite rules are saved in the database after 
they are generated, rather than being generated on each page load, so 
you have to tell WP that it needs to create a new set of rules.

The actions below do not affect rewrite rules, so you don't have to 
flush them.

    --Jennifer

Simon Wheatley wrote:
> On Tue, Mar 17, 2009 at 2:17 PM, Austin Matzko <if.website at gmail.com> wrote:
>> What I do for situations like this is add a rewrite tag for the query
>> var, in a callback for the init action.
>>
>> add_action('init', 'my_init');
>> add_action('parse_query', 'my_parser');
>>
>> function my_init() {
>> global $wp;
>> $wp->add_query_var('custom_content_id');
>> }
>>
> 
> Do you need to flush rewrite rules after doing something like that?
> Not flushing (ahem) was something which caught me out when creating
> custom taxonomies recently.

-- 
Jennifer Hodgdon * Poplar ProductivityWare
www.poplarware.com
Drupal, WordPress, and custom Web programming



More information about the wp-hackers mailing list