From 66b9c9ea6da48685a8b1696b9bbf49a4bb5f6d9c Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Thu, 22 May 2008 16:33:06 +0000 Subject: [PATCH] Remove unnecessary checks for the existence of post meta data. Props filosofo. fixes #7018 git-svn-id: https://develop.svn.wordpress.org/trunk@7985 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/post.php | 17 +++-------------- 1 file changed, 3 insertions(+), 14 deletions(-) diff --git a/wp-includes/post.php b/wp-includes/post.php index 0f4449251f..af9b7527cb 100644 --- a/wp-includes/post.php +++ b/wp-includes/post.php @@ -44,14 +44,9 @@ function update_attached_file( $attachment_id, $file ) { if ( !get_post( $attachment_id ) ) return false; - $old_file = get_attached_file( $attachment_id, true ); - $file = apply_filters( 'update_attached_file', $file, $attachment_id ); - if ( $old_file ) - return update_post_meta( $attachment_id, '_wp_attached_file', $file, $old_file ); - else - return add_post_meta( $attachment_id, '_wp_attached_file', $file ); + return update_post_meta( $attachment_id, '_wp_attached_file', $file ); } /** @@ -1304,8 +1299,7 @@ function wp_insert_post($postarr = array(), $wp_error = false) { else return 0; } - if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template) ) - add_post_meta($post_ID, '_wp_page_template', $page_template, true); + update_post_meta($post_ID, '_wp_page_template', $page_template); } wp_transition_post_status($post_status, $previous_status, $post); @@ -2242,14 +2236,9 @@ function wp_update_attachment_metadata( $post_id, $data ) { if ( !$post =& get_post( $post_id ) ) return false; - $old_data = wp_get_attachment_metadata( $post->ID, true ); - $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID ); - if ( $old_data ) - return update_post_meta( $post->ID, '_wp_attachment_metadata', $data, $old_data ); - else - return add_post_meta( $post->ID, '_wp_attachment_metadata', $data ); + return update_post_meta( $post->ID, '_wp_attachment_metadata', $data); } /**