WordPress Sitemap Generator for Google News
Free download: Google News Sitemap Generator for WordPress
** This is not a WP plug-in, but is a stand-alone script for generating a sitemap RSS feed for Google News.
UPDATE March 10, 2008 - I fixed the invalid date format error bug.
Google announced their new Sitemaps for Google News program on November 21, 2006. I checked it out and the protocol is fairly standard and simple to follow. See the URL above for more information and technical specs.
I modified a simple, standard sitemap generator script (author URL dead) to output a Google News sitemap feed. All you need to do is download and unzip the file (below), open the php file with a standard text editor, modify the categories keywords list (click here for a list of available categories), and upload to your main WordPress directory.
You call up the script directly to generate the Google News sitemap file on-demand. For this site, the URL is http://www.kb3kai.com/david_stansbury/news-sitemap.php.
Once you have the program uploaded and running properly, you need to submit the feed URL to Google. Simply sign into (or sign up for) Google Webmaster Tools and, if your site is already considered a news source by Google, simply submit your feed URL as shown below:

If your site is not in Google News you can request inclusion here.
Download the WordPress script here, verified to work in WordPress 2.0: Google News Sitemap Generator for WordPress
UPDATE March 19, 2008 - I used this script on a live Google-News-worthy website and submitted to Google Webmaster Tools as a Google News sitemap feed. They seem to have accepted it okay, see the screen shot below.

Have fun and happy publishing!
- Dave
Bookmark this to:
del.icio.us
| soc.ialize.us
| digg
| furl
| reddit
| Yahoo
| Google
| Netscape
| Live
| AOL


I’m trying to use this plugin but it isn’t showing up in my “plugins” page; is there a bug?
Comment by Dave — November 25, 2006 @ 4:21 pmActually this is not a WP plugin, but rather a stand-alone addition. You simply copy the script to your default WP directory and call the script directory. For example, on this site you just call http://www.kb3kai.com/david_stansbury/news-sitemap.php and the script returns the RSS on-demand. Or, on your site it might be http://www.profectio.com/news-sitemap.php. If your site is considered a news source by Google (see the G press release about Webmaster Tools integration) you simply submit the URL to the script directly.
Best Regards,
Comment by David Stansbury — November 25, 2006 @ 11:30 pmDave
i have a question [sorry for my bad english] in my WordPress works the Google SiteMaps plugin - this new script works in a different RSS directory? i have problem when the two plugin works again? tnx
Comment by enore savoia — November 28, 2006 @ 2:46 pmGreetings Enore,
The Google News sitemap generator script is stand-alone, and works independently from WordPress functions and plugins. All you need to do is download the script, unzip it, open with notepad and customize the keywords list, save, then upload to your base WordPress folder. Then call the script directly to generate the sitemap XML on demand.
If your site is currently indexed in Google News, you sign into Google Webmaster Tools and submit the URL to the sitemap generator. For example, on my site I would submit
http://www.kb3kai.com/david_stansbury/news-sitemap.php
Have fun and good posting!
- David Stansbury
Comment by David Stansbury — November 28, 2006 @ 10:13 pmtnx very much David … i have submitted the /news-sitemaps/ and works very good … now i must wait for verification of Google Webmaster Tools [pending status]
take care and have your day
Comment by enore savoia — November 29, 2006 @ 12:41 amBest Regards,
Enore
Hello David
Comment by Atomboy — March 3, 2007 @ 4:45 pmMany thanks for making this available, which I am sure will be a lifesaver.
I am unable to test at the moment, but do you know whether this will work on WordPress Mu as well? As it is not a plugin as such, I imagine it will.
Again, many thanks and best wishes.
Hey David,
I love the plugin, but I am getting a strange error with my sitemap and I wanted to see if you’ve seen it before:
Let me know what you think that may be…
Comment by Neil — April 13, 2007 @ 10:24 pmError:
Invalid date
Comment by Giando — October 4, 2007 @ 5:08 amAn invalid date was found. Please fix the date or formatting before resubmitting.
Same to me:
Invalid date
An invalid date was found. Please fix the date or formatting before resubmitting.
I dont no why
Comment by mario — November 1, 2007 @ 4:22 pm*** update ***
I >> finally << fixed the invalid date format thing. I’m now looking at adding some keyword list intelligence, most likely pulling the WP category list if I can master the new WP 2.3 database changes. (rolls eyes)
The download file (link at the top of the page) has been replaced with the corrected version.
http://www.kb3kai.com/david_stansbury/wp-content/2006/11/news-sitemap.zip
- Dave
Comment by David Stansbury — March 10, 2008 @ 4:13 pmHi Dave!
This is absolutely awesome (if I get to use it). I actually chose drupal 6 in favor of wordpress.
In your early posts I see you said it was not a WP plug-in, but standalone. Then there was a fix a couple weeks ago on 03/10/2008.
Was the version prior to 3/10 a generic PHP file or was it still a PHP file with WP references, etc?
I am trying to figure out how to modify for Drupal.
Thanks Dave!
Comment by james — March 27, 2008 @ 4:25 pmGreat News but Google News give an error with your sitemap if you have a Site with more than 1000 urls. Is it possibile to modify this sitemap in order to have only your last 10 articles ? I say this because Google News check regularly when you publish something
Comment by Matteo — April 4, 2008 @ 2:46 amThank you for your script. I use it on my News Site now and i hope that google accept my request.
Ilka
Comment by Ilka — April 6, 2008 @ 5:40 pmShort of removing “disallow for .php” from robots.txt, how can I make this work with Google?
Comment by Anonymous — April 9, 2008 @ 12:47 amCan you limit the Google News Sitemap to only include posts from one particular category of the blog? I am not very good in PHP, MySQL or wordpress coding. I am sure it probably can be modified oon line 43 (select all posts) but could use some help for WHERE category has a particular number. I will play around with it and try not to mess things up, but if you have a quick solution fort his it would be great!
Thanks
Comment by AKirk — May 5, 2008 @ 1:58 pmThis script is just a little outdated, but I touched it up a bit to limit the sitemap to posts instead of pages, limited results to 1000, and also added tag support for keywords:
Find:
$rows = $wpdb->get_results(”SELECT ID, post_date_gmt FROM $wpdb->posts WHERE post_status=’publish’”);
Change that to:
$rows = $wpdb->get_results(”SELECT ID, post_date_gmt FROM $wpdb->posts WHERE post_status=’publish’ and post_type = ‘post’ order by post_date DESC limit 1000″);
Find:
echo “\t\n”;
Change to:
$tagger = ‘Base, keywords’; // change these keywords
echo “\t\n”;
Find:
echo “\t\tU2,U2 tours,news\n”; // change these keywords
Change to:
$tags = get_the_tags($row->ID);
if (!empty($tags)) {
foreach($tags as $tag) {
$tagger .= ‘,’ . $tag->name;
}
}
echo “\t\t$tagger\n”;
Comment by Jeff — May 28, 2008 @ 10:57 amOk, well my mod did not translate well here, but you get the idea. Unfortunately it seems this version of wordpress on this site is munging the code in the comments.
Comment by Jeff — May 28, 2008 @ 10:59 amFirst thanks for the beautiful piece of code.
I have changed the code and now it comes out nice and clear. Two helps required.
In the output I do not see the line breaks between links - how to add that and where…
Also, tell me a way to limit the tag count as its picking up all the tags.
Regards,
Jack.
Comment by Jack — May 30, 2008 @ 12:03 pmToday, I have emerged this error
Comment by makeup — June 10, 2008 @ 3:22 amHi David,
Comment by McCain — June 17, 2008 @ 6:47 pmThis is wonderfully useful. We have two blogs just admitted to Google News. Google News only take articles created in the last 3 days. Anything older creates a zillion errors in Google Webmaster Tools. So I’m wondering if you can modify it to only generate the last 3 days, a change for which I would gladly make a donation.
Thank you for this plugin , wonderfull
Comment by Fabio — June 27, 2008 @ 2:00 amGreat script, works like a charm
.
@McCain: use
AND post_date > SUBDATE(NOW(), 3)
within the script, that should filter out to 3 days back.
Comment by Slevi — July 13, 2008 @ 12:40 pmHi David,
I used your original concept and adapted the code slightly to produce a Wordpress plugin. Below is a link:
http://wordpress.org/extend/plugins/google-news-sitemap-generator/
This can now be installed like a normal Wordpress plugin and automatically updates when you save, publish and delete a post.
I hope this will be useful for someone.
Comment by Chris Jinks — August 4, 2008 @ 7:45 am