Changeset 14814 for trunk/wp-includes/post.php
- Timestamp:
- 05/23/2010 07:49:21 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/post.php
r14713 r14814 1656 1656 * 1657 1657 * @param string|array $mime_types List of mime types or comma separated string of mime types. 1658 * @param string $table_alias Optional. Specify a table alias, if needed. 1658 * @param string $table_alias Optional. Specify a table alias, if needed. 1659 1659 * @return string The SQL AND clause for mime searching. 1660 1660 */ … … 2200 2200 $post_ID = (int) $ID; 2201 2201 $guid = get_post_field( 'guid', $post_ID ); 2202 $post_before = get_post($post_ID); 2202 2203 } 2203 2204 … … 2375 2376 wp_transition_post_status($data['post_status'], $previous_status, $post); 2376 2377 2377 if ( $update ) 2378 if ( $update ) { 2378 2379 do_action('edit_post', $post_ID, $post); 2380 $post_after = get_post($post_ID); 2381 do_action( 'post_updated', $post_ID, $post_after, $post_before); 2382 } 2379 2383 2380 2384 do_action('save_post', $post_ID, $post); … … 3779 3783 * @return int Same as $post_id 3780 3784 */ 3781 function wp_check_for_changed_slugs($post_id) { 3782 if ( empty($_POST['wp-old-slug']) ) 3783 return $post_id; 3784 3785 $post = &get_post($post_id); 3785 function wp_check_for_changed_slugs($post_id, $post, $post_before) { 3786 // dont bother if it hasnt changed 3787 if ( $post->post_name == $post_before->post_name ) 3788 return; 3786 3789 3787 3790 // we're only concerned with published posts 3788 3791 if ( $post->post_status != 'publish' || $post->post_type != 'post' ) 3789 return $post_id; 3790 3791 // only bother if the slug has changed 3792 if ( $post->post_name == $_POST['wp-old-slug'] ) 3793 return $post_id; 3792 return; 3794 3793 3795 3794 $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug'); 3796 3795 3797 3796 // if we haven't added this old slug before, add it now 3798 if ( ! count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) )3799 add_post_meta($post_id, '_wp_old_slug', $ _POST['wp-old-slug']);3797 if ( !in_array($post_before->post_name, $old_slugs) ) 3798 add_post_meta($post_id, '_wp_old_slug', $post_before->post_name); 3800 3799 3801 3800 // if the new slug was used previously, delete it from the list 3802 3801 if ( in_array($post->post_name, $old_slugs) ) 3803 3802 delete_post_meta($post_id, '_wp_old_slug', $post->post_name); 3804 3805 return $post_id;3806 3803 } 3807 3804
Note: See TracChangeset
for help on using the changeset viewer.