#51416 closed defect (bug) (fixed)
PHP Warning during sitemap generation
Reported by: | dd32 | Owned by: | SergeyBiryukov |
---|---|---|---|
Milestone: | 5.6 | Priority: | normal |
Severity: | normal | Version: | |
Component: | Sitemaps | Keywords: | has-patch |
Focuses: | Cc: |
Description
The below error can be encountered during a sitemap render, this happens as the Taxonomy Sitemap provider doesn't expect that get_term_link()
might return a WP_Error.
E_WARNING: wp-includes/formatting.php:4309 - ltrim() expects parameter 1 to be string, object given
In this case, WP_Error
was returning ambiguous_term_id - Term ID is shared between multiple taxonomies
which is actually a second bug here, that the $taxonomy
parameter isn't being passed to properly disambiguate the call.
Attached PR fixes this up.
Attachments (1)
Change History (6)
This ticket was mentioned in PR #557 on WordPress/wordpress-develop by dd32.
4 years ago
#1
- Keywords has-patch added
This ticket was mentioned in Slack in #core-sitemaps by ravi. View the logs.
4 years ago
#3
@
4 years ago
- Milestone changed from Awaiting Review to 5.6
- Owner set to SergeyBiryukov
- Status changed from new to reviewing
dream-encode commented on PR #557:
4 years ago
#5
Merged into WP Core in https://core.trac.wordpress.org/changeset/49137
Avoid a PHP warning on taxonomy sitemaps by checking for error conditions, and avoid error conditions by passing the taxonomy through.
As experienced on WordPress.org
Trac ticket: https://core.trac.wordpress.org/ticket/51416