Action hook 'do_robotstxt'

in WP Core File wp-includes/functions.php at line 1715

View Source

do_robotstxt

Action Hook
Description
Fires when displaying the robots.txt file.

Hook Information

File Location wp-includes/functions.php View on GitHub
Hook Type Action
Line Number 1715

Hook Parameters

This hook doesn't accept any parameters.

Usage Examples

Basic Usage
<?php
// Hook into do_robotstxt
add_action('do_robotstxt', 'my_custom_function');

function my_custom_function() {
    // Your custom code here
}

Source Code Context

wp-includes/functions.php:1715 - How this hook is used in WordPress core
<?php
1710  	/**
1711  	 * Fires when displaying the robots.txt file.
1712  	 *
1713  	 * @since 2.1.0
1714  	 */
1715  	do_action( 'do_robotstxt' );
1716  
1717  	$output = "User-agent: *\n";
1718  	$public = (bool) get_option( 'blog_public' );
1719  
1720  	$site_url = parse_url( site_url() );

PHP Documentation

<?php
/**
	 * Fires when displaying the robots.txt file.
	 *
	 * @since 2.1.0
	 */
Quick Info
  • Hook Type: Action
  • Parameters: 0
  • File: wp-includes/functions.php
Related Hooks

Related hooks will be displayed here in future updates.