Making WordPress.org

Opened 9 years ago

Closed 9 years ago

#1731 closed defect (bug) (fixed)

Fix notice for function wporg_is_handbook on single post pages

Reported by: keesiemeijer's profile keesiemeijer Owned by: coffee2code's profile coffee2code
Milestone: Priority: normal
Component: Handbooks Keywords: has-patch
Cc:

Description

The function wporg_is_handbook() displays this notice on single post pages when used before the queried object is set (as in the pre_get_posts action).

Notice: Trying to get property of non-object in /srv/www/wp-reference/public/wp-includes/query.php on line 4654

This notice originates from WP_Query::is_singular() where get_queried_object() is used.

To fix this warning there needs to be a check if the queried object is set. If it's not set, use the post type query var from the current query to determine if it's a handbook page.

Attachments (1)

1731.patch (1.3 KB) - added by keesiemeijer 9 years ago.
Fix notice

Download all attachments as: .zip

Change History (2)

@keesiemeijer
9 years ago

Fix notice

#1 @coffee2code
9 years ago

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

In 3262:

Handbook plugin: Permit use of wporg_is_handbook() without warnings before main query runs.

Props keesiemeijer.
Fixes #1731.

Note: See TracTickets for help on using tickets.