robots_txt
Filter HookDescription
Filters the robots.txt output.Hook Information
File Location |
wp-includes/functions.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1733 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$output
|
The robots.txt output. |
bool
|
$public
|
Whether the site is considered "public". |
Usage Examples
Basic Usage
<?php
// Hook into robots_txt
add_filter('robots_txt', 'my_custom_filter', 10, 2);
function my_custom_filter($output, $public) {
// Your custom filtering logic here
return $output;
}
Source Code Context
wp-includes/functions.php:1733
- How this hook is used in WordPress core
<?php
1728 * @since 3.0.0
1729 *
1730 * @param string $output The robots.txt output.
1731 * @param bool $public Whether the site is considered "public".
1732 */
1733 echo apply_filters( 'robots_txt', $output, $public );
1734 }
1735
1736 /**
1737 * Displays the favicon.ico file content.
1738 *
PHP Documentation
<?php
/**
* 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".
*/
Quick Info
- Hook Type: Filter
- Parameters: 2
- File: wp-includes/functions.php
Related Hooks
Related hooks will be displayed here in future updates.