Title: wp_no_robots
Published: April 25, 2014
Last modified: April 28, 2025

---

# wp_no_robots()

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#description)
 * [Source](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#wp--skip-link--target)

This function has been deprecated since 5.7.0. Use wp_robots_no_robots() instead
on ‘wp_robots’ filter.

Display a `noindex` meta tag.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#description)󠁿

Outputs a `noindex` meta tag that tells web robots not to index the page content.

Typical usage is as a [‘wp_head’](https://developer.wordpress.org/reference/hooks/wp_head/)
callback:

    ```php
    add_action( 'wp_head', 'wp_no_robots' );
    ```

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#source)󠁿

    ```php
    function wp_no_robots() {
    	_deprecated_function( __FUNCTION__, '5.7.0', 'wp_robots_no_robots()' );

    	if ( get_option( 'blog_public' ) ) {
    		echo "<meta name='robots' content='noindex,follow' />\n";
    		return;
    	}

    	echo "<meta name='robots' content='noindex,nofollow' />\n";
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/deprecated.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/deprecated.php#L4177)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/deprecated.php#L4177-L4186)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#related)󠁿

| Uses | Description | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  | 
| [get_option()](https://developer.wordpress.org/reference/functions/get_option/)`wp-includes/option.php` |

Retrieves an option value based on an option name.

  |

| Used by | Description | 
| [noindex()](https://developer.wordpress.org/reference/functions/noindex/)`wp-includes/deprecated.php` |

Displays a `noindex` meta tag if required by the blog configuration.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_no_robots/?output_format=md#changelog)󠁿

| Version | Description | 
| [5.7.0](https://developer.wordpress.org/reference/since/5.7.0/) | Deprecated. Use [wp_robots_no_robots()](https://developer.wordpress.org/reference/functions/wp_robots_no_robots/) instead on `'wp_robots'` filter. | 
| [5.3.0](https://developer.wordpress.org/reference/since/5.3.0/) | Echo `noindex,nofollow` if search engine visibility is discouraged. | 
| [3.3.0](https://developer.wordpress.org/reference/since/3.3.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_no_robots%2F)
before being able to contribute a note or feedback.