Skip to content

Commit 9687905

Browse files
authored
remove hardcoded /wp-admin
1 parent b226691 commit 9687905

1 file changed

Lines changed: 2 additions & 4 deletions

File tree

src/wp-includes/functions.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1718,10 +1718,8 @@ function do_robots() {
17181718
$output = "User-agent: *\n";
17191719
$public = (bool) get_option( 'blog_public' );
17201720

1721-
$site_url = parse_url( site_url() );
1722-
$path = ( ! empty( $site_url['path'] ) ) ? $site_url['path'] : '';
1723-
$output .= "Disallow: $path/wp-admin/\n";
1724-
$output .= "Allow: $path/wp-admin/admin-ajax.php\n";
1721+
$output .= 'Disallow: ' . (string) wp_parse_url( admin_url(), PHP_URL_PATH ) . "\n";
1722+
$output .= 'Allow: ' . (string) wp_parse_url( admin_url( 'admin-ajax.php' ), PHP_URL_PATH ) . "\n";
17251723

17261724
/**
17271725
* Filters the robots.txt output.

0 commit comments

Comments
 (0)