Computers, Gadgets and Beyond!

Google News plugin

April 07, 2008 By: webmaster Category: WordPress Plugins

Displays N first news items from a selectable Google News RSS feed, inline or as a widget.

Google aggregates news from over 4500 news sources, updated continously. The results can be retrieved as a number of RSS feeds, where you can create your own specific feed by specifying one of more than 40 regions/languages, and an optional topic ranging from Domestic to Most Popular to Entertainment. Currently there are nine topics, including, of course, All. In addition to this, any feed can be filtered through a search query so that only news items matching your query will be shown. Note that not all combinations of region/language and topic has been enabled by Google but it should degrade gracefully.

This plugin works both as a widget, as inline content replacement and can be used in themes. It can be used as both simultaneously, but there can be only one instance of the widget. Multiple feeds can be configured and used accordingly.

NOTE! Always upgrade to the latest version if you experience problems, most things are fixed already. 🙂

The latest version is 2.5.

If you’ve configured feeds that use character sets like cyrillic, arabic and you’re getting errors from WP when trying to view the feeds then your WP MySQL database tables may be created with the wrong character set. Let me know and I’ll give you some pointers.

Download Google News plugin

If you have a question or other comment, use the form below. Thank you!

Known bugs:

  • There is a bug in the WordPress RSS engine, that sometimes show up when people use this widget. If you get something resembling “unknown function debug() in line 504 of wp-includes/rss.php” then that’s one of them. WP is aware of the problem, and apparently a fixed rss.php might be showing up in the next release. As a quick-fix edit wp-includes/rss.php and change line 503 from if ( MAGPIE_DEBUG ) { to if ( MAGPIE_DEBUG > 1 ) {
  • When the widget fails with a php error like the one above, the template goes out of whack. I’ve made sure none of those are my fault in the next minor upgrade due out soon. I’m looking at better workarounds for the bug above first, so release might be a short while yet. Don’t want to spam you all with multiple releases like some widget writers…

Example of inline content replacement.

Default feed <–google-news–>, alternating randomly between two feeds:

    No default feed available

A different feed <–google-news#non-default–>:

Shortcode test non-default [ google-news name=”non-default” ]:

    No default feed available

Shortcode test default [ google-news ]:

    No default feed available

Random test:

Shortcodes are only available in WordPress 2.5 and up.

111 Comments to “Google News plugin”

  1. Hi jtsone and Rasheed!
    I’m now running WP 2.7 here, and all admin-pages and other parts of the Google News plugin appears to be working fine. If you still have problems after upgrading to 2.7 final then let me know and I’ll try to debug.


  2. Ah, edit/delete seems to be stuffed under 2.7 yes. I’ll find out what the WP-boys have done to the code this time around and release an updated plugin. Hopefully this weekend.


  3. Waiting for your WP 2.7 compatibility update….

    please hurry 🙂


  4. Hey Olav,

    I’ve just sent you an email. Your fix appears to be working.


  5. We cannot manage the google News, No Chance to Edit, Delete or adding extra feed. We revolution templage with WP 2.7.

    Best Thomas

  6. I noticed this entry:
    webmaster Says:
    June 25th, 2008 at 18:53

    Hi Karan!
    If Google is unavailable all the time, then it’s most likely a problem at your hosting provider. They may, as with Katrina, be a PHP configuration option that blocks outgoing connection attempts. It may also be a firewall that block outgoing connections. Do you have access to the webserver logs for your site? If so, see if there are PHP warnings/errors there that may indicate that outbound access is blocked. Either by PHP settings or an external firewall. Also, if you have access to the web server itself, you can try to access something remote with “telnet google 80″. If that fails, then you’re most likely firewalled. If that’s the case, the plugin won’t work unless you get them to open up. Note they will have to open for several external addresses at Google, so let me know if that’s the problem and I will provide you with the sites to open for.”

    I am having the same problem. I have contacted my hosting provider, and they want me to fill out this form:
    Please allow the outbound connections for scripts for FTP username: (my username)
    Local script filename (and location) which needs the outbound connection:

    Remote server IP address and port number:

    Exact purpose of this connection:

    Please note that our firewall is IP based. If the remote host changes its IP address in the future, please notify us of the change.

    What information should I fill this form out with?
    Thank you.
    I appreciate your time and feedback.-Jeff

  7. I set up the PlugIn (Google News ver 2.4) in WP 2.3.3, today, and I get the ‘error’: “Google News unavailable”. The only filter word I passed was ‘OR Nacke Rygg’.

    Is there a problem with Google News (API) it selves?


  8. Hello,
    I have Google News plugin, worked fine for awhile, but now I am getting broken html coding on the page.

    Works good in the Item Length> short mode, when switching to long mode I get the broken html coding.

    What can cause this?

    Mike B

  9. I’m trying to set up the RSS feed for Google news using this plug-in. However, my web host blocks outbound connections.

    They’re asking for the following information:
    Local script filename (and location) which needs the outbound connection:

    Remote server IP address and port number:

    Exact purpose of this connection:

    What do I give them for the remote server IP address and port number?
    Thank you.

  10. I am using WP2.7.1

    I am running two sites with WP, but the Google-News plugin only works with one of the sites.

    I put the [google-news name="business"] in a text widget, and I put the identical shortcode in my second site but it won’t work. I checked to make sure both sites were set up identically. Both use a different theme, however.

    Using the Text widget I was not able to get anything to work using

    Thanks for any help…

  11. Hi Tom!
    It sounds vaguely like the theme on your second site has a problem with widgets in widgets. Do you get any outout if you try a random other widget that produces some output in more or less the same manner as the Google-Newx plugin?

  12. Hi Nisse!
    The unavailable-message can be a result of various reasons. What happens if you try a standard feed without any filtering words? Still the same problem? Can you see if you can reach the server news.google.com on port 80 from your wordpress server? Some ISPs may block outbound traffic, which is the most common scenario here.

  13. I had about 10 feeds setup, added number 11, and all of them were suddenly deleted. 🙁

    Has anyone seen this before?

  14. Hi brettbum!
    Hm, that’s a new one. I’ll try making that many feeds myself and see what happens. I can’t really think of anything in the plugin that would cause this to happen. The data about the feeds is stored in your MySQL backend database using the WordPress API, so the bug could really be anywhere. What version of WordPress are you running?

  15. Andrew M says:

    Hello, I love the Google News plugin, but I have one question/suggestion. I’d like to be able to rel=nofollow the news links and can’t seem to find out where in the code to place that. A little help would be much appreciated.

  16. Hi Andrew!
    This one is actually non-trivial. The content that Google provides here is really a pre-formatted HTML-blob, and all the href’s are in there. So you’d need a preg_replace() call that looks for a ‘href’ and replaces it with a ‘rel=nofollow href’. I have it on my list of possible enhancements, but just not gotten around to doing it yet. If you want a suitable place in the plugin to try this on your own, then look for the line that has ‘squat’ in it. Around there is a good place to add the preg_replace().


  17. Exellent plugin, but the region/country I live in is not listed …

    For a country-specific feed not listed, can I add it manually in the script?

    Best –

  18. Hello, very nice plugin, but it stopped working once I upgraded to WP 2.7. I get an invalid url message (“The previous page is sending you to an invalid url.”) upon clicking on each link this plugin delivers… Both with and without a filter. Yes, I’m using the latest 2.4 version of the plugin. Is there a cure for this yet?

  19. Hi, can any one tell me where do I need to put in order to calling plugin from theme. Any help would be appriciated.

  20. Hi Dan!
    The plugin lists all the regions/countries that Google provided when the plugin was released. If they have added more regions after that, then just add them manually to the script and you should be good to go. However, if you add regions not (yet) provided by Google, then nothing will happen.


  21. Hi ir!
    Hm, new one to me. I’m running the plugin on several WP 2.7 sites, and haven’t had this problem at all. Can you provide me with a link to your site so I can see it fail?


  22. Hi Joe!
    Sorry about the abysmal reply time, been moving house. About the filtering. Yes, it’s just a very limited filter support in the plugin at the moment. I could add more features here with very little job, I just wasn’t sure if the filtering was a feature people would bother to use at all. Apparently it is, so I’ll expand it a little. The query method provided by google here is a bit of a pain, as you can’t just give it the old “something+OR+something+else” string. You have to pass individual search parameters to different cgi script variables depending on whether you want say AND or OR. Haven’t looked at the api lately though, so they may have come up with something better.


  23. Hi Steven!
    Sorry about the late reply, been moving house. Not quite sure what’s wrong based on your error message. I’ll send you an email and see if we can clear things up.


  24. Cynthia says:

    HELP! My client wants to eliminate the words “Google News : U.S. : All” from the top of our google feed.

    Is this possible? I looked at the coding, but it doesn’t seem very easy to do. If you have suggestions, please share them.

    Thank you! :o)

  25. Cynthia says:

    Hello – can anybody tell me how to REMOVE the words “Google: US: All” at the top of this plug-in? My client doesn’t want it to show up, but I can’t find where the code is.


  26. Hi Osvaldo!
    I’ll have a look. Can you provide me with the feed definitions you have? I.e. language, location, etc so that I can replicate your setup here?


  27. Hi Cynthia!
    In the Feed definition, you have an optional “Admin-defined title”. You can set this to whatever you want. Note that Google Terms Of Use require you to show that the feeds come from Google. Hope this helps.


  28. This plugin is great! Worked first time, and without coding I made a widget and added to my front page. But: I’d really like to have a second widget, with a different news selection. It seems I can only have one Google News widget — is that right? Or can I make one by putting the shortcode into some other widget?

  29. Thanks, your plugin works perfect, except from news from Norway. Nothing shows up from Norway. Hvorfor ikke det??

  30. When I peview it looks okay, but when I publish, the titles don’t wrap around and the links are not active. WP 2.8.

  31. Hi KenN!
    At the moment you can only have one widget yes, I’ll look into the possibilities of having multiple widgets from the same plugin. But as you say you can use the shortcode and/or WP function calls more or less anywhere you want, so you can get more than one news listing per site that way. The PHP Code plugin (that lets you put arbitrary PHP code into a widget) may also be a possibility here.


  32. Hi John!

    Fordi 🙂 As noted in the readme, there are combinations of locations and news types that do not work, e.g that Google do not have an rss feed for. For example, Kenya may not have an Entertainment feed but perhaps a Business feed etc. There isn’t a list of what works and what doesn’t, so you’ll just have to test. The “All” type should work for all locations, including Norway.


  33. Hi, i being using your plugin , google news ,
    out put i have it set to with image,

    i only see the image but no text displaying
    i have tried using only txt and still only image shows.

    any clues.

    thank you

  34. Hi Iris!
    Your first problem, where your summaries do not include links, sounds like a theme-problem. Perhaps your theme strips all links from the summaries? Should be fairly easy to fix if that is the case, but it has to be done in the theme.

    As for the long vs short version, what kind of output do you get from the long version. Nothing at all? Have you tried for “U.S.” and “All”? I’ve never had that problem before, where you get the short but not the long output. They’re just different ways of displaying the exact same rss feed, so if one works so should the other. The messiness comes from Google I’m afraid, they screen scrape news sites and pass the result on to the RSS feed more or less without any cleanups. The plugin does quite a bit of cleanup, but can’t catch all the strangeness that comes along.

    The mouseover textbox is default for the plugin, so if you’re not seeing those on your short-type feeds then I’m pretty sure that’s due to something in your theme and/or CSS-files. The plugin use on this site is completely stock, just unzipped the plugin and defined a couple of normal feeds for testing.

    The CNN plugin doesn’t work for you either, or was that a typo for Google plugin? I’m presuming the latter. Look for an updated CNN plugin in a couple of days, where I’ve added more international feeds. But you will most likely see exactly the same problems there, as both plugins are more or less indentical internally.

    Do you have a web site I can look at to see your problems live?


  35. Hi, I really like the idea of this widget, but can’t seem to get it to work. What am I doing wrong?


  36. Hi, i being using your pluging at the begining , I did an update and the option to be able to see image with txt description .

    Output type: with image Item length: Long
    click on the link so you could see what i get.
    My only option is to use Output: with image Item lenght: short to get small description but no image.

    But still don’t get no image,

    Thank you , in advance


  37. Hi,
    I am having a problem with the widget. I have numerous feeds defined, but when I select something other than “DEFAULT” and click save, it reverts back to “DEFAULT”. I assumed I am doing something wrong but can’t seem to figure it out.

    Cheers & Thanks in advance,


  38. Nice pluging. Thank you.

    How do I make it display in the same font and size as the rest of my sidebar? I’ve tried altering my theme’s style CSS, but I’m not a programmer. Can you help? Thanks again.

  39. great plugin.
    I consider filtering crucial and of significant added value. Thus it would be very helpful if you publish a short ‘guide’ or ‘manual’ on the search strings (query strings) applicable. I am thinking of AND, OR, NOT, compound words as e.g. “financial crisis”, etc.

    Thanks in advance.

  40. dEstRoyer says:

    my plugin suddenly stopped working. All I get is “Google News unavailable” it returns that when i’m calling a feed that DOES exist. I tried requesting a feed that doesn’t exist and it give me the standard error. This was working one minute, not the next.

    Is the Google News unavailable a common error? are my settings incorrect? any ideas…

  41. I am having the same issue as Bob above…nothing but thumbnails without any description renders the plugin useless as it just displays random pictures on my page!!

  42. If I install this as a widget , all of the other widgets disappear, what am I missing?

  43. L. Scott says:

    Thanks for the plugin. I’m new to WP and BP so this helps me alot.

    I can’t seem to get the query filter to work. Is there a certain way the words go in the query? I’ll use the word boxing…I’ve tried it as…Boxing…”Boxing”…[Boxing]…=Boxing…’Boxing’…none have filtered the category.

    I’m new to all this so be gentle.


  44. I’m using your plugin as follows:

    Call with PHP using “php shortcode” plugin within “section widget” plugin.

    Works beautifully, including multiple instances.


    It fails to refresh. The cache time had been set to 300 seconds. I reset it to 1800 seconds, wondering if perhaps it was trying to refresh too frequently.

    No luck so far.

    Any thoughts?

  45. Lucas Monteverde says:

    This plugin does not seem to be working in Portuguese, I had to make an adjustment in the code region of Brazil to ‘pt-BR_br’, but was still conflicting with the variable outputtype ‘=’ t ‘; solved it worked properly

  46. I’m also getting “Google News unavailable” in the sidebar widget. Are you still supporting your plugin?

    Thanks in advance.

  47. Hi,

    This is a great app. It was working well, but all of a sudden it stopped and just says Google News unavailable on the home page. I’ll have to take it down if I can’t fix it.

    I was trying to insert some code for the google verification and analytics tracking. I put Google’s code in the header section. The verification worked but the analytics didn’t. Could this be related to the problem?

    Also recently started having trouble with a BBC news widget before your app went down.

    Thanks a lot for the help. Please keep up the good work!


  48. Hello there. Your script seems perfect.
    Only problem is I can not get it to work?

    I have the plugin installed on WP. Completed the setup questions. I then created a “text” widget box. Inside the widget box I put the code:
    do_action(‘google_news’, ‘feedname’);

    QUESTION: What am I doing wrong? What should go in the widget box?

  49. Thanks for the plugin! Works great.
    Is there anyway to have the links open in a new window? Tried several things in the google_news.php but got errors with everthing I tried.
    Any help greatly appreciated.


1 Trackbacks/Pingbacks

  1. just built our new 2012 Page with a high-detail image of a Maya Calendar | mini-tick.com 19 11 10

Leave a Reply