Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




do_robots [ WordPress Function ]

do_robots ( No parameters )
Uses:
Defined at:



Display the robots.txt file content.

The echo content should be with usage of the permalinks or for creating the robots.txt file.

Source


<?php
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_urlsite_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);
}
?>

Examples [ wp-snippets.com ]

Google Arama Sonuçlarý

Dahasý ...

0 User Note(s)

Henüz yok. Ýlk sen ol!

Yeni Ekle ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics