Changeset 33261
- Timestamp:
- 07/14/2015 12:27:03 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r33234 r33261 3452 3452 3453 3453 if ( empty( $data['post_name'] ) && ! in_array( $data['post_status'], array( 'draft', 'pending', 'auto-draft' ) ) ) { 3454 $data['post_name'] = sanitize_title( $data['post_title'], $post_ID);3454 $data['post_name'] = wp_unique_post_slug( sanitize_title( $data['post_title'], $post_ID ), $post_ID, $data['post_status'], $post_type, $post_parent ); 3455 3455 $wpdb->update( $wpdb->posts, array( 'post_name' => $data['post_name'] ), $where ); 3456 3456 } -
trunk/tests/phpunit/tests/post.php
r33096 r33261 413 413 414 414 /** 415 * @ticket 5305 416 */ 417 public function test_wp_insert_post_should_not_allow_a_bare_numeric_slug_that_might_conflict_with_a_date_archive_when_generating_from_an_empty_post_title() { 418 global $wp_rewrite; 419 $wp_rewrite->init(); 420 $wp_rewrite->set_permalink_structure( '/%postname%/' ); 421 $wp_rewrite->flush_rules(); 422 423 $p = wp_insert_post( array( 424 'post_title' => '', 425 'post_content' => 'test', 426 'post_status' => 'publish', 427 'post_type' => 'post', 428 ) ); 429 430 $post = get_post( $p ); 431 432 $wp_rewrite->set_permalink_structure( '' ); 433 434 $this->assertEquals( "$p-2", $post->post_name ); 435 } 436 437 /** 415 438 * @ticket 5364 416 439 */
Note: See TracChangeset
for help on using the changeset viewer.