|
/ Documentation /Developers Documentation/ Customize Robots Meta Tags surerank_robots_meta_array

Customize Robots Meta Tags surerank_robots_meta_array

Hook: surerank_robots_meta_array

Description: Use the surerank_robots_meta_array filter to customize the output of the <meta name="robots"> tag on your site. This allows you to dynamically control search engine behavior by adding, modifying, or removing directives like noindex, nofollow, noarchive, and more. This hook is especially useful when you want to fine-tune the visibility of specific pages or sections for SEO purposes.

Source: inc/frontend/robots.php

Usage: Modify the array of robots directives before they are rendered in the HTML <head> section.

Example:

PHP
// Add 'nofollow' to the robots meta tag using the SureRank filter
add_filter( 'surerank_robots_meta_array', 'custom_robots' ); 
function custom_robots( $robots ) { 
    $robots[] = 'nofollow'; 
    return $robots; 
}

You can add the example code to your child theme’s functions.php file or use a plugin like Code Snippets to safely insert custom code. Using a code snippet plugin is recommended for easier management and to ensure the code remains active even if you switch themes.

Was this doc helpful?
What went wrong?

We don't respond to the article feedback, we use it to improve our support content.

Need help? Contact Support
On this page
Scroll to Top