Well, I continue to stumble across various problems, and solutions.  But I rarely keep track of what I’ve learned.  So its probably a good idea to keep track of these things.  For my own use, and maybe I can help somebody along the way.  It’ s been a while since we covered anything WordPress.  A while back we had some articles that dealt with fixing hacked blogs, and those were pretty popular.  So here we go with a new tip.

First off, the problem:

For years now, and quite randomly it seems, my RSS feed language would disappear.  I like to check on the health of my sites whenever possible with tools like Is My Blog Working, W3C Markup Validator and the W3C Feed Validator.  Go ahead, check yours now, I’ll wait!  OK, all done?  Well every few months my language would disappear and my feed would become invalid.  This can cause issues with various readers, or with trying to utilize your feed on certain services.

Now, I’ve never been able to get rid of the problem, and I’ve never found what causes my language to disappear.  I had tried various ways to solve the problem.  First off I went to my options page and changed it there whenever I had the problem.  That works, but as the page grows, it can be hard to find the option amongst hundreds of other things.  So next up I used a mySQL query to fix the language in the options table.  But this was also time consuming as I had to log onto my hosts site and get into phpmyadmin and run the query.  Plus neither of these solutions is ideal, as I need to continually check my feed to see if the language is gone.

So finally I posted the topic up on the WordPress forums and found a pretty neat solution.  All we need to do is drop a bit of code into our functions.php file and we are all set!

function fix_my_rss_please(){
                   wp_mail('EMAIL ADDRESS', 'rss language lost again','but I auto fixed it');

Of course in the above code you would need to change EMAIL ADDRESS to your email address, and possible change en to your preferred language.  But that’s it.  If your RSS language ever disappears agin, you will be sent an email so you can investigate the cause.  But not only that, the language will be changed to whatever you set in the code automatically.  Nifty eh?