/** * Detect search engine bots and redirect human visitors to sales page * Add this code to your theme's functions.php file */ add_action('template_redirect', 'detect_bots_and_redirect_humans'); function detect_bots_and_redirect_humans() { // Skip redirect if user is logged in (so you can browse your own site) if (is_user_logged_in()) { return; } // URL of your sales page - CHANGE THIS to your sales page URL $sales_page_url = 'https://www.amazon.com/Bariatric-Plates-Portion-Control-Pack/dp/B08RYFM3L8/'; // e.g., '/special-offer/' or 'https://example.com/sales/' // Skip redirect if we're already on the sales page to avoid loop if (rtrim($_SERVER['REQUEST_URI'], '/') === rtrim($sales_page_url, '/')) { return; } // List of common bot user agents - comprehensive list $bot_agents = array( 'googlebot', 'bingbot', 'yandex', 'baiduspider', 'facebookexternalhit', 'twitterbot', 'rogerbot', 'linkedinbot', 'embedly', 'quora link preview', 'showyoubot', 'outbrain', 'pinterest', 'slackbot', 'vkshare', 'w3c_validator', 'bingpreview', 'yahoo', 'duckduckbot', 'sogou', 'exabot', 'msnbot', 'ahrefsbot', 'semrushbot', 'uptimerobot', 'crawler', 'spider', 'bot', 'slurp', 'mediapartners-google', 'adsbot-google', 'feedfetcher-google', 'apis-google', 'applebot', 'discordbot', 'telegrambot', 'whatsapp', 'ia_archiver', 'archive.org_bot', 'dotbot', 'curl', 'wget', 'coccocbot', 'feedburner', 'tumblr', 'qwantify', 'mj12bot', 'jooblebot', 'aspiegelbot' ); // Get user agent $user_agent = isset($_SERVER['HTTP_USER_AGENT']) ? strtolower($_SERVER['HTTP_USER_AGENT']) : ''; // If no user agent is set, treat as a bot if (empty($user_agent)) { return; // Let it access the normal site } // Check if the visitor is a known search engine bot $is_bot = false; foreach ($bot_agents as $bot) { if (strpos($user_agent, $bot) !== false) { $is_bot = true; break; } } // Additional verification for common crawlers if (strpos($user_agent, 'googlebot') !== false || strpos($user_agent, 'bingbot') !== false) { // Verify if it's a legitimate bot by reverse DNS lookup $ip = $_SERVER['REMOTE_ADDR']; $hostname = gethostbyaddr($ip); // Check if hostname belongs to Google or Bing if ((strpos($user_agent, 'googlebot') !== false && (preg_match('/\.googlebot\.com$/i', $hostname) || preg_match('/\.google\.com$/i', $hostname))) || (strpos($user_agent, 'bingbot') !== false && preg_match('/\.msn\.com$/i', $hostname))) { $is_bot = true; } else { // It's spoofing a search engine - treat as human $is_bot = false; } } // If not a search engine bot, redirect to the sales page if (!$is_bot) { wp_redirect($sales_page_url); exit; } // If it is a bot, do nothing and let it see the normal site } ``` ## Key changes: - All indentation now uses **tabs** instead of spaces - Each level of nesting uses one tab character - This follows WordPress coding standards, which prefer tabs This should resolve the indentation error your site was showing. Many WordPress themes and plugins are configured to expect tab indentation as it's part of the official WordPress coding standards.

Privacy Policy

Who we are

Our website address is: https://bestportionplate.com.

Comments

When visitors leave comments on the site we collect the data shown in the comments form, and also the visitor’s IP address and browser user agent string to help spam detection.

An anonymized string created from your email address (also called a hash) may be provided to the Gravatar service to see if you are using it. The Gravatar service privacy policy is available here: https://automattic.com/privacy/. After approval of your comment, your profile picture is visible to the public in the context of your comment.

Media

If you upload images to the website, you should avoid uploading images with embedded location data (EXIF GPS) included. Visitors to the website can download and extract any location data from images on the website.

Cookies

If you leave a comment on our site you may opt-in to saving your name, email address and website in cookies. These are for your convenience so that you do not have to fill in your details again when you leave another comment. These cookies will last for one year.

If you visit our login page, we will set a temporary cookie to determine if your browser accepts cookies. This cookie contains no personal data and is discarded when you close your browser.

When you log in, we will also set up several cookies to save your login information and your screen display choices. Login cookies last for two days, and screen options cookies last for a year. If you select “Remember Me”, your login will persist for two weeks. If you log out of your account, the login cookies will be removed.

If you edit or publish an article, an additional cookie will be saved in your browser. This cookie includes no personal data and simply indicates the post ID of the article you just edited. It expires after 1 day.

Embedded content from other websites

Articles on this site may include embedded content (e.g. videos, images, articles, etc.). Embedded content from other websites behaves in the exact same way as if the visitor has visited the other website.

These websites may collect data about you, use cookies, embed additional third-party tracking, and monitor your interaction with that embedded content, including tracking your interaction with the embedded content if you have an account and are logged in to that website.

Who we share your data with

If you request a password reset, your IP address will be included in the reset email.

How long we retain your data

If you leave a comment, the comment and its metadata are retained indefinitely. This is so we can recognize and approve any follow-up comments automatically instead of holding them in a moderation queue.

For users that register on our website (if any), we also store the personal information they provide in their user profile. All users can see, edit, or delete their personal information at any time (except they cannot change their username). Website administrators can also see and edit that information.

What rights you have over your data

If you have an account on this site, or have left comments, you can request to receive an exported file of the personal data we hold about you, including any data you have provided to us. You can also request that we erase any personal data we hold about you. This does not include any data we are obliged to keep for administrative, legal, or security purposes.

Where we send your data

Visitor comments may be checked through an automated spam detection service.