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
This commit is contained in:
Scott Taylor 2015-10-13 16:40:26 +00:00
parent dc92982950
commit 45a0c26091
3 changed files with 12 additions and 3 deletions

View File

@ -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 = '';
}
?>
<div class="tagsdiv" id="<?php echo $tax_name; ?>">
<div class="jaxtag">
<div class="nojs-tags hide-if-js">
<p><?php echo $taxonomy->labels->add_or_remove_items; ?></p>
<textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?>><?php echo str_replace( ',', $comma . ' ', get_terms_to_edit( $post->ID, $tax_name ) ); // textarea_escaped by esc_attr() ?></textarea></div>
<textarea name="<?php echo "tax_input[$tax_name]"; ?>" rows="3" cols="20" class="the-tags" id="tax-input-<?php echo $tax_name; ?>" <?php disabled( ! $user_can_assign_terms ); ?>><?php echo str_replace( ',', $comma . ' ', $terms_to_edit ); // textarea_escaped by esc_attr() ?></textarea></div>
<?php if ( $user_can_assign_terms ) : ?>
<div class="ajaxtag hide-if-no-js">
<label class="screen-reader-text" for="new-tag-<?php echo $tax_name; ?>"><?php echo $box['title']; ?></label>

View File

@ -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 '<div class="tags_input" id="'.$taxonomy_name.'_'.$post->ID.'">'
. esc_html( str_replace( ',', ', ', get_terms_to_edit( $post->ID, $taxonomy_name ) ) ) . '</div>';
. esc_html( str_replace( ',', ', ', $terms_to_edit ) ) . '</div>';
}
}

View File

@ -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.