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' ) ?>
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;
}
robots_tcht
is called from do_robots(), located in
wp-includes/functions.php
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()