Definition:
function do_robots() {}
Display the robots.txt file content.
The echo content should be with usage of the permalinks or for creating the robots.txt file.
Defined filters
- robots_txt
apply_filters('robots_txt', $output, $public)
Defined actions
- do_robotstxt
do_action( 'do_robotstxt' );
Source code
function do_robots() { header( 'Content-Type: text/plain; charset=utf-8' ); do_action( 'do_robotstxt' ); $output = "User-agent: *\n"; $public = get_option( 'blog_public' ); if ( '0' == $public ) { $output .= "Disallow: /\n"; } else { $site_url = parse_url( site_url() ); $path = ( !empty( $site_url['path'] ) ) ? $site_url['path'] : ''; $output .= "Disallow: $path/wp-admin/\n"; $output .= "Disallow: $path/wp-includes/\n"; } echo apply_filters('robots_txt', $output, $public); }
968
No comments yet... Be the first to leave a reply!