Changeset 34685 for trunk/src/wp-includes/post-functions.php
- Timestamp:
- 09/29/2015 04:57:02 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post-functions.php
r34668 r34685 1331 1331 * and `use_featured_image` labels. 1332 1332 * @since 4.4.0 Added the `insert_into_item` and `uploaded_to_this_item` labels. 1333 * 1333 * 1334 1334 * @access private 1335 1335 * … … 3281 3281 */ 3282 3282 do_action( 'edit_attachment', $post_ID ); 3283 $post_after = get_post( $post_ID ); 3284 3285 /** 3286 * Fires once an existing attachment has been updated. 3287 * 3288 * @since 4.4.0 3289 * 3290 * @param int $post_ID Post ID. 3291 * @param WP_Post $post_after Post object following the update. 3292 * @param WP_Post $post_before Post object before the update. 3293 */ 3294 do_action( 'attachment_updated', $post_ID, $post_after, $post_before ); 3283 3295 } else { 3284 3296 … … 5134 5146 */ 5135 5147 function wp_check_for_changed_slugs( $post_id, $post, $post_before ) { 5136 // Don't bother if it hasn t changed.5137 if ( $post->post_name == $post_before->post_name ) 5148 // Don't bother if it hasn't changed. 5149 if ( $post->post_name == $post_before->post_name ) { 5138 5150 return; 5151 } 5139 5152 5140 5153 // We're only concerned with published, non-hierarchical objects. 5141 if ( $post->post_status != 'publish' || is_post_type_hierarchical( $post->post_type ) )5154 if ( ! ( 'publish' === $post->post_status || ( 'attachment' === get_post_type( $post ) && 'inherit' === $post->post_status ) ) || is_post_type_hierarchical( $post->post_type ) ) { 5142 5155 return; 5143 5144 $old_slugs = (array) get_post_meta($post_id, '_wp_old_slug'); 5156 } 5157 5158 $old_slugs = (array) get_post_meta( $post_id, '_wp_old_slug' ); 5145 5159 5146 5160 // If we haven't added this old slug before, add it now. 5147 if ( !empty( $post_before->post_name ) && !in_array($post_before->post_name, $old_slugs) ) 5148 add_post_meta($post_id, '_wp_old_slug', $post_before->post_name); 5161 if ( ! empty( $post_before->post_name ) && ! in_array( $post_before->post_name, $old_slugs ) ) { 5162 add_post_meta( $post_id, '_wp_old_slug', $post_before->post_name ); 5163 } 5149 5164 5150 5165 // If the new slug was used previously, delete it from the list. 5151 if ( in_array($post->post_name, $old_slugs) ) 5152 delete_post_meta($post_id, '_wp_old_slug', $post->post_name); 5166 if ( in_array( $post->post_name, $old_slugs ) ) { 5167 delete_post_meta( $post_id, '_wp_old_slug', $post->post_name ); 5168 } 5153 5169 } 5154 5170
Note: See TracChangeset
for help on using the changeset viewer.