[wp-hackers] Help with wp_rewrite?

Derek Hogue derek at amphibian.info
Sat Dec 1 19:03:02 GMT 2007

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;

// This is for the init action hook
function 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:


This is alright - but I don't totally see why this can't work:


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?


More information about the wp-hackers mailing list