Make WordPress Core


Ignore:
Timestamp:
10/13/2015 04:39:47 PM (11 years ago)
Author:
wonderboymusic
Message:

Taxonomy: get_terms_to_edit() can also return false or WP_Error. Vars using it should be set to empty string when errors are returned to avoid producing fatal errors when used in string operations.

Props valendesigns.
Fixes #30472.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/template-functions.php

    r35128 r35139  
    315315        } elseif ( $taxonomy->show_ui ) {
    316316
     317            $terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name );
     318            if ( ! is_string( $terms_to_edit ) ) {
     319                $terms_to_edit = '';
     320            }
     321
    317322            echo '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">'
    318                 . esc_html( str_replace( ',', ', ', get_terms_to_edit( $post->ID, $taxonomy_name ) ) ) . '</div>';
     323                . esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>';
    319324
    320325        }
Note: See TracChangeset for help on using the changeset viewer.