Make WordPress Core

Opened 9 years ago

Closed 9 years ago

Last modified 9 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:


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 9 years ago.
9482-2.patch (829 bytes) - added by johnbillion 9 years ago.
updated patch

Download all attachments as: .zip

Change History (9)

9 years ago

#1 @johnbillion
9 years ago

  • Keywords has_patch added


9 years ago

updated patch

#3 @johnbillion
9 years ago

Updated patch as per DD's suggestion.

#4 @Viper007Bond
9 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

#5 @Viper007Bond
9 years ago

  • Keywords has-patch added; has_patch removed

Oh, dur.

#6 @ryan
9 years ago

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

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

#7 @automattor
9 years ago

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

Note: See TracTickets for help on using tickets.