Beware of feed structure modification when writing a plugin

It just puzzled me why my feed xml structure at http://mightyhitter.com/feed/ output an error because of the MightyStats . After few checks to the source, I noticed that if the function is called upon generation of the_content(), so it might as well will be called during generation of xml feed (because xml feed is content too).

But I still need MightyStats in place!

So I made a search to any function or global variables that can tell me exactly at which page my function is running. I know there is a is_page(), and later I found is_feed(). Yeah, but read some comments here at http://wordpress.or.../support/topic/48921 about the $doing_rss global variable.

Well, I took alphaoide advise and it just working smoothly. My function will do nothing if it found that the calling script is a feed generator.

Posted March 5th, 2006 by mightyhitter under PHP, Wordpress

 

Leave a Reply