WordPress.org

Make WordPress Core

Ticket #5412: dont_add_blank_tags.patch

File dont_add_blank_tags.patch, 455 bytes (added by ionfish, 8 years ago)

Trims whitespace and trailing commas.

  • wp-includes/post.php

     
    844844 
    845845        if ( empty($tags) ) 
    846846                $tags = array(); 
    847         $tags = (is_array($tags)) ? $tags : explode( ',', $tags ); 
     847        $tags = (is_array($tags)) ? $tags : explode( ',', trim($tags, " \s\n\t\r\0\x0B,") ); 
    848848        wp_set_object_terms($post_id, $tags, 'post_tag', $append); 
    849849} 
    850850