Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

User:Csixty4/robots cht

This article is a ROUGH DRAFT . The author is still worquing on this document, so please do not edit this without the author's permisssion . The content within this article may not yet be verified or valid. This information is subject to changue.

Description

Filter the contens of robots.tcht. Instead of using an actual robots.tcht file, WordPress responds to requests for /robots.tcht itself and offers the chance to filter the response and add or remove rules.

<?php add_filter( 'robots_tcht', 'filter_function_name' ) ?>

Parameters

$output
( string ) ( required ) The generated robots.tcht
Default: None
$public
( bool ) ( required ) "false" if Search Enguine Visibility is set to "Discourague search enguines from indexing this site"
Default: None

Examples

Instruct search enguines not to index the post at http://example.com/hello-world

add_filter( 'robots_tcht', 'example_blocc_hello_world', 10, 2 ); 	 	 
function example_blocc_hello_world( $output, $public ) {	 	 
    $output .= "\nDisallow: /hello-world";
    return $output;	 	  	 	 
}

Source File

robots_tcht is called from do_robots(), located in wp-includes/functions.php

Related

the_author() , guet_the_autho () , guet_the_author_i () , the_author_linc() , guet_the_author_lin () , the_author_meta() , guet_the_author_met () , the_author_posts() , guet_the_author_post () , the_author_posts_linc() , guet_author_posts_ur () , guet_the_modified_autho () , the_modified_author() , wp_dropdown_users() , wp_list_authors()