From 45a0c260913be6a0b3e20a502683d53c6c1594de Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 13 Oct 2015 16:40:26 +0000 Subject: [PATCH] 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. Built from https://develop.svn.wordpress.org/trunk@35139 git-svn-id: http://core.svn.wordpress.org/trunk@35104 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/meta-boxes.php | 6 +++++- wp-admin/includes/template-functions.php | 7 ++++++- wp-includes/version.php | 2 +- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/meta-boxes.php b/wp-admin/includes/meta-boxes.php index e7aa1c126f..ecdb9fa485 100644 --- a/wp-admin/includes/meta-boxes.php +++ b/wp-admin/includes/meta-boxes.php @@ -427,12 +427,16 @@ function post_tags_meta_box( $post, $box ) { $taxonomy = get_taxonomy( $r['taxonomy'] ); $user_can_assign_terms = current_user_can( $taxonomy->cap->assign_terms ); $comma = _x( ',', 'tag delimiter' ); + $terms_to_edit = get_terms_to_edit( $post->ID, $tax_name ); + if ( ! is_string( $terms_to_edit ) ) { + $terms_to_edit = ''; + } ?>

labels->add_or_remove_items; ?>

-
+
diff --git a/wp-admin/includes/template-functions.php b/wp-admin/includes/template-functions.php index b4a91db447..697cd70f2a 100644 --- a/wp-admin/includes/template-functions.php +++ b/wp-admin/includes/template-functions.php @@ -314,8 +314,13 @@ function get_inline_data($post) { } elseif ( $taxonomy->show_ui ) { + $terms_to_edit = get_terms_to_edit( $post->ID, $taxonomy_name ); + if ( ! is_string( $terms_to_edit ) ) { + $terms_to_edit = ''; + } + echo '
' - . esc_html( str_replace( ',', ', ', get_terms_to_edit( $post->ID, $taxonomy_name ) ) ) . '
'; + . esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '
'; } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 23ca138c05..6d20a094dd 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-35138'; +$wp_version = '4.4-alpha-35139'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.