Display Custom Content to Search Engine Visitors

Posted on January 22nd, 2011

Display custom content to your search-engine traffic by placing the following code into your theme’s functions.php file:

<?php function scratch99_fromasearchengine() {


$SE  = array(‘/search?’, ‘images.google.’, ‘web.info.com’, ‘search.’, ‘del.icio.us/search’, ‘soso.com’, ‘/search/’, ‘.yahoo.’);

foreach($SE as $source) {

if(strpos($ref, $source) !== false) return true;


return false;



After checking and editing the $SE arrays with the search-engine referrer information of your choice, place the next chunk of code into the desired display location in your theme file(s):

<?php if(function_exists(‘scratch99_fromasearchengine’)) {

if (scratch99_fromasearchengine()) {



} ?>

Add whatever content or code you wish to the specified area and enjoy targeted delivery to search-engine visitors only.