WordPress.org

Make WordPress Core

Opened 4 years ago

Closed 4 years ago

Last modified 4 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)

comment:1 nacin4 years ago

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

comment:2 follow-up: dd324 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.

comment:4 hakre4 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.

comment:5 nacin4 years ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

dd32 indicated he wanted to review this further.

comment:6 mtdewvirus4 years ago

  • Cc mtdewvirus@… added

comment:7 in reply to: ↑ 2 nacin4 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.

comment:8 dd324 years ago

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

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

comment:9 automattor4 years ago

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

Note: See TracTickets for help on using tickets.