robots_txt
Filters the robots.txt output.
Использование
add_filter( 'robots_txt', 'wp_kama_robots_txt_filter', 10, 2 ); /** * Function for `robots_txt` filter-hook. * * @param string $output The robots.txt output. * @param bool $public Whether the site is considered "public". * * @return string */ function wp_kama_robots_txt_filter( $output, $public ){ // filter... return $output; }
- $output(строка)
- The robots.txt output.
- $public(true|false)
- Whether the site is considered "public".
Список изменений
С версии 3.0.0 | Введена. |
Где вызывается хук
robots_txt
wp-includes/functions.php 1727
echo apply_filters( 'robots_txt', $output, $public );
Где используется хук в WordPress
wp-includes/sitemaps/class-wp-sitemaps.php 78
add_filter( 'robots_txt', array( $this, 'add_robots' ), 0, 2 );