Changeset 31392
- Timestamp:
- 02/09/2015 10:53:40 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/post.php
r31359 r31392 338 338 $clean_terms = array(); 339 339 foreach ( $terms as $term ) { 340 // Empty terms are invalid input. 341 if ( empty( $term ) ) { 342 continue; 343 } 344 340 345 $_term = get_terms( $taxonomy, array( 341 346 'name' => $term, -
trunk/tests/phpunit/tests/admin/includesPost.php
r31359 r31392 177 177 178 178 /** 179 * @ticket 30615 180 */ 181 public function test_edit_post_should_not_create_terms_for_an_empty_tag_input_field() { 182 $u = $this->factory->user->create( array( 'role' => 'editor' ) ); 183 wp_set_current_user( $u ); 184 185 register_taxonomy( 'wptests_tax', array( 'post' ) ); 186 $t1 = $this->factory->term->create( array( 187 'taxonomy' => 'wptests_tax', 188 'name' => 'foo', 189 'slug' => 'bar', 190 ) ); 191 192 $p = $this->factory->post->create(); 193 194 $post_data = array( 195 'post_ID' => $p, 196 'tax_input' => array( 197 'wptests_tax' => ' ', 198 ), 199 ); 200 201 edit_post( $post_data ); 202 203 $found = wp_get_post_terms( $p, 'wptests_tax' ); 204 205 $this->assertEmpty( $found ); 206 } 207 208 /** 179 209 * @ticket 27792 180 210 */
Note: See TracChangeset
for help on using the changeset viewer.