WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#9482 closed defect (bug) (fixed)

is_home() returns true for the robots.txt handler

Reported by: johnbillion Owned by: markjaquith
Milestone: 2.7.2 Priority: normal
Severity: normal Version: 2.7.1
Component: Canonical Keywords: robots.txt is_robots is_home, is_front_page has-patch
Focuses: Cc:

Description

If your site does not have a robots.txt file and example.com/robots.txt is requested, WordPress kicks in and generates a robots.txt file for you.

The problem is that is_home() returns true at this point when it shouldn't. This can cause problems with plugins/themes that hook into the template_redirect hook and then redirect or alter output based on the is_home() conditional.

The end result is that a site can be outputting a complete page when example.com/robots.txt is requested, instead of the plain robots.txt file.

Also affects is_front_page() where applicable.

Attachments (2)

9482.patch (498 bytes) - added by johnbillion 6 years ago.
9482-2.patch (829 bytes) - added by johnbillion 6 years ago.
updated patch

Download all attachments as: .zip

Change History (9)

@johnbillion6 years ago

comment:1 @johnbillion6 years ago

  • Keywords has_patch added

Patch

@johnbillion6 years ago

updated patch

comment:3 @johnbillion6 years ago

Updated patch as per DD's suggestion.

comment:4 @Viper007Bond6 years ago

  • Keywords changed from robots.txt, is_robots, is_home, is_front_page, has_patch to robots.txt is_robots is_home, is_front_page has_patch

comment:5 @Viper007Bond6 years ago

  • Keywords has-patch added; has_patch removed

Oh, dur.

comment:6 @ryan6 years ago

  • Resolution set to fixed
  • Status changed from new to closed

(In [10920]) robots.txt is not home. Props johnbillion. fixes #9482

comment:7 @automattor6 years ago

(In [10921]) robots.txt is not home. Props johnbillion. fixes #9482 for 2.7

Note: See TracTickets for help on using tickets.