[wp-trac] [WordPress Trac] #39860: Multiple Themes: Check for WP_Error before outputting `get_the_tag_list()`

WordPress Trac noreply at wordpress.org
Mon Feb 13 15:32:34 UTC 2017


#39860: Multiple Themes: Check for WP_Error before outputting `get_the_tag_list()`
---------------------------+-----------------------------
 Reporter:  sixhours       |      Owner:
     Type:  defect (bug)   |     Status:  new
 Priority:  normal         |  Milestone:  Awaiting Review
Component:  Bundled Theme  |    Version:  trunk
 Severity:  normal         |   Keywords:
  Focuses:                 |
---------------------------+-----------------------------
 We've seen this error pop up on WordPress.com for multiple _s-based and
 default themes:

 `Catchable fatal error - Object of class WP_Error could not be converted
 to string`

 This happens because `get_the_tag_list()` can return an object of
 `WP_Error` and the theme doesn't account for it. Core handles it
 gracefully if the theme uses `the_tags()` instead.

 Affected themes:

 * Twenty Seventeen
 * Twenty Fifteen
 * Twenty Thirteen
 * Twenty Twelve
 * Twenty Eleven
 * Twenty Ten

 I propose we patch these to account for `WP_Error`. Two possible
 solutions:

 1. If echoing the output, switch to `the_tags()`.
 2. If returning the tags list, add a catch for `is_wp_error()` in the
 function to avoid the fatal error.

 I'll add some patches to get this started.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/39860>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list