Make WordPress Core


Ignore:
Timestamp:
05/13/2009 05:15:27 AM (16 years ago)
Author:
ryan
Message:

Remove stale enclosures. Props mystyman. fixes #6840

File:
1 edited

Legend:

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

    r11290 r11315  
    10611061 * Check content for video and audio links to add as enclosures.
    10621062 *
    1063  * Will not add enclosures that have already been added. This is called as
     1063 * Will not add enclosures that have already been added and will
     1064 * remove enclosures that are no longer in the post. This is called as
    10641065 * pingbacks and trackbacks.
    10651066 *
     
    10911092    debug_fwrite( $log, 'Post contents:' );
    10921093    debug_fwrite( $log, $content . "\n" );
     1094
     1095    foreach ( $pung as $link_test ) {
     1096        if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post
     1097            $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test . '%') );
     1098        }
     1099    }
    10931100
    10941101    foreach ( (array) $post_links_temp[0] as $link_test ) {
Note: See TracChangeset for help on using the changeset viewer.