#26064 closed defect (bug) (fixed)
Twenty Fourteen: Correct $query usage in Featured_Content::pre_get_posts()
| Reported by: | SergeyBiryukov | Owned by: | lancewillett |
|---|---|---|---|
| Priority: | normal | Milestone: | 3.8 |
| Component: | Bundled Theme | Version: | 3.8 |
| Severity: | normal | Keywords: | |
| Cc: | Focuses: |
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.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
Thank you for the ticket and updated fix, I was going to ask for a longer explanation anyway. :)