WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

#12707 closed defect (bug) (fixed)

term_description() shouldn't return error objects

Reported by: filosofo Owned by:
Priority: normal Milestone: 3.0
Component: Template Version: 3.0
Severity: normal Keywords: has-patch term_description commit
Cc:

Description

term_description() and its wrappers like category_description() are meant to be used in templates, so they shouldn't return WP_Error objects.

However, if you call term_description() for a non-existent term you get a fatal error as PHP attempts to treat the WP_Error object as a string.

Patch instead returns an empty string when an error bubbles up to term_description().

Attachments (1)

term_description-error_handling.12707.diff (496 bytes) - added by filosofo 3 years ago.

Download all attachments as: .zip

Change History (3)

comment:1 scribu3 years ago

  • Keywords commit added

Looks good.

comment:2 ryan3 years ago

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.