WordPress: remove category posts from RSS feed
Want to say thanks to jangro.com for having a WordPress function to block a specific WordPress category from appearing in my RSS feed. I just added this to my theme’s function.php file and changed the category number to the number of the category to omit and voila, the RSS feed is now free of the other category.
function myFilter($query) {
if ($query->is_feed) {
$query->set('cat','-5');
}
return $query;
}
add_filter('pre_get_posts','myFilter');
PHP Array output offset by 1?
Today I was writing some code for another site and I was looping through a DB query and outputting the results and I noticed that the output was one index off. If you ever encounter this problem make sure that you do not have your query string followed by $row = mysql_fetch_array($query) and then have $row = mysql_fetch_array($query) in the WHILE statement for your loop.