Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#33483 closed defect (bug) (invalid)

Logic error in wp_delete_term

Reported by: ipm-frommen Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Taxonomy Keywords:
Focuses: Cc:


Yesterday I was debugging some stuff related to term deletion. That's when I saw this:

if ( isset( $args['default'] ) ) {
    $default = (int) $args['default'];
    if ( ! term_exists( $default, $taxonomy ) ) {
        unset( $default );

In effect, this does something like unset( 1 ); (in case the term with ID 1 is the default term). I suppose, this should be unset( $args['default'] );, right?

Change History (1)

#1 @swissspidy
6 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed

$args is never used later in the function. However, there are several isset( $default) checks. So unsetting $default in case a term doesn't exist makes sense.

Note: See TracTickets for help on using tickets.