Opened 8 years ago
Closed 8 years ago
#45811 closed defect (bug) (duplicate)
debug warnings generated on 404 feed
| Reported by: | wpmuguru | Owned by: | |
|---|---|---|---|
| Priority: | normal | Milestone: | |
| Component: | Query | Version: | 5.0.2 |
| Severity: | minor | Keywords: | |
| Cc: | Focuses: |
Description
When a site has a plugin active that use is_singular with a $post_type parameter in template_redirect (or similar hook) debug warnings of
PHP Notice: Trying to get property of non-object
when a non-existent /some-slug/feed/ url is requested.
Original discussion: https://github.com/woocommerce/woocommerce/issues/21756
Change History (2)
Note:
See TracTickets
for help on using tickets.
![(please configure the [header_logo] section in trac.ini)](/chrome/site/your_project_logo.png)
This problem occurs because
\WP_Query::is_singular()does not check ifget_queried_object()returnsnullbefore checking forget_queried_object()->post_type.Adding a check to the core function beforehand should solve the problem. I will need to check if it's needed for
\WP_Query::is_single()and other related functions.Others will know the history of
is_singular()better than I, so I will leave it for someone else to decide if a fix should go into core.---
@wpmuguru FYI: I hit this bug recently for the
template_redirecthook and worked around it with the code:But you've probably figured that out :)