What Would Seth Godin Do – WordPress plugin patch

This patch can be applied to version 1.5 of WWSG – if You use other version, more recent, You need to change this by hand, using idea from this patch.

I do use WordPress on few sites and I like it. Well, it is not ideal, but it has very strong community, which makes WP perfect tool for blogging.

Community provided plugins are great, and one of them which I use on each site is What Would Seth Godin Do. This plugin shows each new visitor short message. Message invites to subscribe to RSS feed, or whatever else blog author will configure.

New visitors are recognized by cookies and message can be placed on the post beginning or end. Trouble strikes when You put this message ahead post and user does not support cookies. Then every time post will begin with If you’re new here, you may want to subscribe to my RSS feed. Thanks for visiting! in default WWSGD setup. So what, You ask? One of those users is Googlebot, and believe You don’t want him to see this.

Now (short) story time. I have setup 30 Day Trial blog to document my progress with different attempts on self improvement. Of course I have setup WWSGD and this time I was using message box before post. After few days I was checking if my site got indexed by Google and:

What Google see

What Does Google See - Can You Spot a Pattern?

My incentive to grab RSS feed has become main part of excerpt served by Google in search results. Not good. But. It is enough to skip this message for Googlebot and… We have simple patch:

Index: what_would_seth_godin_do.php
--- what_would_seth_godin_do.php        (revision 42)
+++ what_would_seth_godin_do.php        (working copy)
@@ -120,11 +120,16 @@

+//Skip Google bot - do not offer Google opportunity to sign to Your feed ;)
+function skip_this_user_agent() {
+       return 0 != preg_match( "/Googlebot/", $_SERVER['HTTP_USER_AGENT'] );
 function wwsgd_message_filter($content = '')
        global $wwsgd_visits, $wwsgd_settings, $wwsgd_messagedisplayed;

-       if ($wwsgd_messagedisplayed || is_feed())
+       if ($wwsgd_messagedisplayed || is_feed() || skip_this_user_agent() )
                return $content;

Of course it could check against more User Agent strings (Ask, Live.com, others?) but who cares :) It works for me:

And what does Google see now?

And what does Google see now?

To patch or not to patch?

Much better. If You do use this plugin I suggest You to patch WWSGD (of course in case You need some help with patching…).