WordPress.org

Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#12707 closed defect (bug) (fixed)

term_description() shouldn't return error objects

Reported by: filosofo Owned by:
Milestone: 3.0 Priority: normal
Severity: normal Version: 3.0
Component: Template Keywords: has-patch term_description commit
Focuses: 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 10 years ago.

Download all attachments as: .zip

Change History (3)

#1 @scribu
10 years ago

  • Keywords commit added

Looks good.

#2 @ryan
10 years ago

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