Commit 07bfe37
committed
Robots: Use
Derive the `Disallow` and `Allow` directives in `do_robots()` from `admin_url()` and `admin_url( 'admin-ajax.php' )` rather than from a hardcoded `/wp-admin/` path built off `site_url()`. Only the URL path portion is emitted, as before, so installs that relocate or filter their admin URL now produce a correct default `robots.txt`.
Also guard the `Content-Type` header with a `headers_sent()` check to avoid a warning when the headers have already been sent.
Developed in WordPress#11998.
Follow-up to r34985.
Props masteradhoc, yogeshbhutkar, hrohh, westonruter, mukeshpanchal27, 1ucay.
Fixes #63467.
git-svn-id: https://develop.svn.wordpress.org/trunk@62633 602fd350-edb4-49c9-b593-d223f7449a82admin_url() for the robots.txt admin paths.1 parent 97e8e28 commit 07bfe37
2 files changed
Lines changed: 25 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1711 | 1711 | | |
1712 | 1712 | | |
1713 | 1713 | | |
1714 | | - | |
| 1714 | + | |
| 1715 | + | |
| 1716 | + | |
1715 | 1717 | | |
1716 | 1718 | | |
1717 | 1719 | | |
| |||
1723 | 1725 | | |
1724 | 1726 | | |
1725 | 1727 | | |
1726 | | - | |
1727 | | - | |
1728 | | - | |
1729 | | - | |
| 1728 | + | |
| 1729 | + | |
1730 | 1730 | | |
1731 | 1731 | | |
1732 | 1732 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
147 | 167 | | |
148 | 168 | | |
149 | 169 | | |
| |||
0 commit comments