Opened 8 years ago
Closed 8 years ago
#38277 closed defect (bug) (duplicate)
the_tags() will fatal error if get_the_tag_list() fails
Reported by: | claudiulodro | Owned by: | |
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | |
Component: | Taxonomy | Keywords: | |
Focuses: | Cc: |
Description
On failure, get_the_tag_list (used by the_tags() ) will return a WP_Error object. the_tags() has no checking for this WP_Error object, so it will throw a fatal error when it tries to echo the WP_Error object that get_the_tag_list returned. My proposed solution is as follows:
<?php function the_tags( $before = null, $sep = ', ', $after = '' ) { if ( null === $before ) $before = __( 'Tags: ' ); $tag_list = get_the_tag_list( $before, $sep, $after ); if( is_wp_error( $tag_list ) ) { return; } echo $tag_list; }
I will attach a formal patch for this soon as I have a chance.
Change History (1)
Note: See
TracTickets for help on using
tickets.
Hello @claudiulodro, welcome to Trac!
Thanks for your report, we're already tracking this issue in #37291.