wp-includes/functions.php:1713Displays the default robots.txt file content.
2 hooks fire while do_robots() runs, in this order:
Fires when displaying the robots.txt file.
function do_robots() { if ( ! headers_sent() ) { header( 'Content-Type: text/plain; charset=utf-8' ); } /** * Fires when displaying the robots.txt file. * * @since 2.1.0 */ do_action( 'do_robotstxt' ); $output = "User-agent: *\n"; $public = (bool) get_option( 'blog_public' ); $output .= 'Disallow: ' . wp_parse_url( admin_url(), PHP_URL_PATH ) . "\n"; $output .= 'Allow: ' . wp_parse_url( admin_url( 'admin-ajax.php' ), PHP_URL_PATH ) . "\n"; /** * Filters the robots.txt output. * * @since 3.0.0 * * @param string $output The robots.txt output. * @param bool $public Whether the site is considered "public". */ echo apply_filters( 'robots_txt', $output, $public );}Introduced in 2.1.0. Unchanged from 6.7.7 through 7.1.0.
Signature, return type and hooks compared across 5 parsed releases.
src/wp-includes/functions.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.