WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#18109 closed defect (bug) (fixed)

is_singular is being called on _close_comments_for_old_posts

Reported by: luis.ferro Owned by: ryan
Milestone: 3.3 Priority: normal
Severity: normal Version: 3.2
Component: Query Keywords: has-patch needs-testing
Focuses: Cc:

Description

wp-includes/comment.php (as of version 3.2.1)

Line 1965 calls for is_singular when on certain situations, the query was not yet performed, generating the following error:

Notice: is_singular was called incorrectly. Conditional query tags do not work before the query is run. Before then, they always return false. (This message was added in version 3.1.) wp-includes/functions.php on line 3501

The message pointing to functions.php is not very helpful either, but nothing that a debug_backtrace doesn't sort out.

Attachments (1)

18109.diff (1.6 KB) - added by kawauso 10 years ago.
Use the query object method instead

Download all attachments as: .zip

Change History (4)

@kawauso
10 years ago

Use the query object method instead

#1 @kawauso
10 years ago

  • Keywords has-patch needs-testing added

Attached patch uses the is_singular() method of the query object that triggered 'the_posts' hook rather than the function which relies on $wp_query.

#2 @SergeyBiryukov
10 years ago

  • Milestone changed from Awaiting Review to 3.3

#3 @ryan
10 years ago

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

In [18836]:

Pass the query object to _close_comments_for_old_posts() so that is_singular is checked for the proper query. Props kawauso. fixes #18109

Note: See TracTickets for help on using tickets.