I use the "No Adverts for Friends" plugin by Donncha O Caoimh

ID || $comment_author ) ) { return true; } else { return false; } } function is_whitelisted_site( $url ) { global $nevershowads; if( $url != '' ) { foreach( $nevershowads as $whitesite ) { if( strpos( $url, $whitesite ) ) return true; } } return false; } function is_old_post() { if( is_whitelisted_site( $_SERVER[ 'HTTP_REFERER' ] ) ) return false; if( is_regular_user() ) return false; if( get_post_time() < date( 'U' ) - 2678400 ) return true; return false; } function is_searchengine_user() { global $passingthrough; if( is_whitelisted_site( $_SERVER[ 'HTTP_REFERER' ] ) ) return false; if( is_regular_user() ) return false; if( is_page() ) return false; if( $_COOKIE[ '7a1254cba80da02d5478d91cfd0a873a' ] == 1 ) return true; if( $_SERVER[ 'HTTP_REFERER' ] != '' ) { foreach( $passingthrough as $url ) { if( strpos( $_SERVER[ 'HTTP_REFERER' ], $url ) ) { @setcookie( '7a1254cba80da02d5478d91cfd0a873a', 1, time()+3600, '/' ); return true; } } } if( is_old_post() ) return true; return false; } add_action( 'init', 'is_searchengine_user' ); ?>