[wp-hackers] Help with wp_rewrite?

Jennifer Hodgdon yahgrp at poplarware.com
Mon Dec 3 18:20:47 GMT 2007


You probably need to flush the rewrite rules after doing add_feed, so 
that your special feed/gigpress rewrite rule gets created. Probably 
adding the add_feed line inside your flush_rules function would do the 
trick. I'm not entirely sure, but it seems like it should...

     --Jennifer

Derek Hogue wrote:
> Hey all,
> 
> Thanks for the words of advice Andy, DD32, and Jennifer - all helpful.
> 
> Andy's tip about mod_rewrite_rules looked promising, but alas, WP tacks 
> those onto the end of everything else, and my rule gets squashed.
> 
> However, upon further investigation, it looks like what I really wanted 
> to do was use add_feed.  It's really poorly documented, but it does 
> work.  This is what I've found works:
> 
> // Flush our rewrite rules before running add_feed
> function gigpress_flush_rules(){
>     global $wp_rewrite;
>     $wp_rewrite->flush_rules();
> }
> register_activation_hook(__FILE__,'gigpress_flush_rules');
> 
> 
> // This is for the init action hook
> function add_gigpress_feed() {
>     add_feed('gigpress','gigpress_feed');
> }
> add_action(init,'add_gigpress_feed');
> 
> (This is added on init as per: 
> <http://comox.textdrive.com/pipermail/wp-trac/2007-July/014207.html>)
> 
> // Build the feed
> function gigpress_feed() {
>     // function that prints the XML
> }
> 
> HOWEVER!  It's only working using direct queries, ie:
> 
> www.example.com/?feed=gigpress
> 
> This is alright - but I don't totally see why this can't work:
> 
> www.example.com//feed/gigpress
> 
> Surely when using add_feed, WP should treat it as any other feed - 
> including giving it permalink treatment? If WP knows that 'gigpress' has 
> been added as a valid feed variable, shouldn't it be able to parse the 
> permalinks in the same manner?


-- 
Jennifer Hodgdon

Poplar ProductivityWare * www.poplarware.com
Web Databases/Scripts * Modeling/Analysis/Palm OS Software



More information about the wp-hackers mailing list