Make WordPress Core


Ignore:
Timestamp:
09/24/2009 05:10:28 PM (15 years ago)
Author:
ryan
Message:

Actions for postmeta updates. Props Demitrious Kelly. see #10750

File:
1 edited

Legend:

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

    r11961 r11968  
    11641164    foreach ( $pung as $link_test ) {
    11651165        if ( !in_array( $link_test, $post_links_temp[0] ) ) { // link no longer in post
    1166             $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 . '%') );
     1166            $mid = $wpdb->get_col( $wpdb->prepare("SELECT meta_id FROM $wpdb->postmeta WHERE post_id = %d AND meta_key = 'enclosure' AND meta_value LIKE (%s)", $post_ID, $link_test . '%') );
     1167            do_action( 'delete_postmeta', $mid );
     1168            $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE post_id IN(%s)", implode( ',', $mid ) ) );
     1169            do_action( 'deleted_postmeta', $mid );
    11671170        }
    11681171    }
     
    11871190                    $meta_value = "$url\n$len\n$type\n";
    11881191                    $wpdb->insert($wpdb->postmeta, array('post_id' => $post_ID, 'meta_key' => 'enclosure', 'meta_value' => $meta_value) );
     1192                    do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, 'enclosure', $meta_value );
    11891193                }
    11901194            }
Note: See TracChangeset for help on using the changeset viewer.