[wp-trac] Re: [WordPress Trac] #6970: Add_feed - bug and fix - Replacing callback function

WordPress Trac wp-trac at lists.automattic.com
Wed May 14 22:26:51 GMT 2008


#6970: Add_feed - bug and fix - Replacing callback function
------------------------------------+---------------------------------------
 Reporter:  programming.has.no.com  |        Owner:  anonymous
     Type:  defect                  |       Status:  new      
 Priority:  high                    |    Milestone:  2.6      
Component:  General                 |      Version:  2.5.1    
 Severity:  normal                  |   Resolution:           
 Keywords:  add_feed                |  
------------------------------------+---------------------------------------
Comment (by programming.has.no.com):

 Replying to [comment:2 ryan]:
 > How about always removing the default function for that feed?

 Yer that would work, and save changing the function arguments... How about
 this version?

 function add_feed($feedname, $function) {
         global $wp_rewrite;
         if (!in_array($feedname, $wp_rewrite->feeds)) { //override the
 file if it is
                 $wp_rewrite->feeds[] = $feedname;
         }
         $hook = 'do_feed_' . $feedname;
         remove_action($hook, $hook, 10, 1);
         add_action($hook, $function, 10, 1);
         return $hook;
 }

-- 
Ticket URL: <http://trac.wordpress.org/ticket/6970#comment:3>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list