From d929461fd8dfa7a6ff6ad65e2014d44a2669d750 Mon Sep 17 00:00:00 2001 From: Scott Taylor Date: Tue, 13 Oct 2015 16:39:47 +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. git-svn-id: https://develop.svn.wordpress.org/trunk@35139 602fd350-edb4-49c9-b593-d223f7449a82 --- src/wp-admin/includes/meta-boxes.php | 6 +++++- src/wp-admin/includes/template-functions.php | 7 ++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/wp-admin/includes/meta-boxes.php b/src/wp-admin/includes/meta-boxes.php index e7aa1c126f..ecdb9fa485 100644 --- a/src/wp-admin/includes/meta-boxes.php +++ b/src/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/src/wp-admin/includes/template-functions.php b/src/wp-admin/includes/template-functions.php index b4a91db447..697cd70f2a 100644 --- a/src/wp-admin/includes/template-functions.php +++ b/src/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 ) ) . '
'; } }