#26064 closed defect (bug) (fixed)
Twenty Fourteen: Correct $query usage in Featured_Content::pre_get_posts()
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Milestone: | 3.8 | Priority: | normal |
| Severity: | normal | Version: | 3.8 |
| Component: | Bundled Theme | Keywords: | |
| Focuses: | Cc: |
Description
Background: [26189] (which should have had a ticket).
Featured_Content::pre_get_posts() has some issues:
- No need to set the default
$queryvalue to false. The method is hooked topre_get_postsaction and is not called separately, so aWP_Queryobject is always passed. - The
is_a( $query, 'WP_Query' )check is redundant for the same reason. $query->is_home()method should be used instead of theis_home()template tag. Before [26189], this was causing a_doing_it_wrong()notice in unit tests. [26189] avoided the notice by movingis_home()to the end of the condition. I guess using$query->is_home()would be the more correct fix.
Attachments (1)
Change History (4)
Note: See
TracTickets for help on using
tickets.
Thank you for the ticket and updated fix, I was going to ask for a longer explanation anyway. :)