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
This commit is contained in:
parent
0a8b41c950
commit
d929461fd8
@ -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>
|
||||
|
@ -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>';
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user