WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

Last modified 6 years ago

#12256 closed defect (bug) (fixed)

robots.txt not generated without posts

Reported by: willshouse Owned by: ryan
Milestone: 3.0 Priority: normal
Severity: normal Version: 2.8.6
Component: Query Keywords:
Focuses: Cc:

Description

when there are no posts and only pages, robots.txt is not available (try accessing it via the browser) even when entries are being generated by the hook 'do_robots'

To fix the problem, create one published post. to re-create the problem, delete or un-publish the post.

I have been using WP for some sites which are only pages and no posts and so i believe it will be important to fix this issue. after all,
wordpress did win the award for best cms this year ( http://wordpress.org/development/2009/11/wordpress-wins-cms-award/ )

Change History (9)

#1 @nacin
6 years ago

  • Component changed from General to Query
  • Milestone changed from Unassigned to 3.0
  • Owner set to ryan

#2 follow-up: @dd32
6 years ago

On a robots request, WordPress appears to make a SQL request for the same as it would on a Home index page.

handle_404() throws a 404 if there are 0 posts matched.

Ideally, WordPress should not query the database for posts on robots.txt requests.

I'll commit a change to display the robots.txt page with 0 posts, but I'd prefer to see something happen about that Querying.. It might require an extra internal request var, along the lines of 'plugin-handled-no-404' or something.. Pure thoughts there.

#4 @hakre
6 years ago

  • Keywords needs-patch removed
  • Resolution set to fixed
  • Status changed from new to closed

I would not say "even". This is clearly a bug IMHO.

#5 @nacin
6 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

dd32 indicated he wanted to review this further.

#6 @mtdewvirus
6 years ago

  • Cc mtdewvirus@… added

#7 in reply to: ↑ 2 @nacin
6 years ago

Replying to dd32:

On a robots request, WordPress appears to make a SQL request for the same as it would on a Home index page. ... I'd prefer to see something happen about that Querying.

Looks like they were trying to review this in #10886.

#8 @dd32
6 years ago

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

Closing as fixed then, Remaining issues can be handled in #10886.

#9 @automattor
6 years ago

(In [13323]) Restore [13194] which was accidentally overwritten in [13315]. See #12256

Note: See TracTickets for help on using tickets.