Make WordPress Core

Changeset 7985


Ignore:
Timestamp:
05/22/2008 04:33:06 PM (17 years ago)
Author:
ryan
Message:

Remove unnecessary checks for the existence of post meta data. Props filosofo. fixes #7018

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/post.php

    r7978 r7985  
    4545        return false;
    4646
    47     $old_file = get_attached_file( $attachment_id, true );
    48 
    4947    $file = apply_filters( 'update_attached_file', $file, $attachment_id );
    5048
    51     if ( $old_file )
    52         return update_post_meta( $attachment_id, '_wp_attached_file', $file, $old_file );
    53     else
    54         return add_post_meta( $attachment_id, '_wp_attached_file', $file );
     49    return update_post_meta( $attachment_id, '_wp_attached_file', $file );
    5550}
    5651
     
    13051300                return 0;
    13061301        }
    1307         if ( ! update_post_meta($post_ID, '_wp_page_template',  $page_template) )
    1308             add_post_meta($post_ID, '_wp_page_template',  $page_template, true);
     1302        update_post_meta($post_ID, '_wp_page_template',  $page_template);
    13091303    }
    13101304
     
    22432237        return false;
    22442238
    2245     $old_data = wp_get_attachment_metadata( $post->ID, true );
    2246 
    22472239    $data = apply_filters( 'wp_update_attachment_metadata', $data, $post->ID );
    22482240
    2249     if ( $old_data )
    2250         return update_post_meta( $post->ID, '_wp_attachment_metadata', $data, $old_data );
    2251     else
    2252         return add_post_meta( $post->ID, '_wp_attachment_metadata', $data );
     2241    return update_post_meta( $post->ID, '_wp_attachment_metadata', $data);
    22532242}
    22542243
Note: See TracChangeset for help on using the changeset viewer.