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-admin/includes/post.php

    r11930 r11968  
    589589
    590590        $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta (post_id,meta_key,meta_value ) VALUES (%s, %s, %s)", $post_ID, $metakey, $metavalue) );
     591        do_action( 'added_postmeta', $wpdb->insert_id, $post_ID, $metakey, $metavalue );
     592       
    591593        return $wpdb->insert_id;
    592594    }
     
    609611    wp_cache_delete($post_id, 'post_meta');
    610612
    611     return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
     613    do_action( 'delete_postmeta', $mid );
     614    $rval = $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
     615    do_action( 'deleted_postmeta', $mid );
     616
     617    return $rval;
    612618}
    613619
     
    698704    $where = compact( 'meta_id' );
    699705
    700     return $wpdb->update( $wpdb->postmeta, $data, $where );
     706    do_action( 'update_postmeta', $meta_id, $post_id, $meta_key, $meta_value );
     707    $rval = $wpdb->update( $wpdb->postmeta, $data, $where );
     708    do_action( 'updated_postmeta', $meta_id, $post_id, $meta_key, $meta_value );
     709
     710    return $rval;
    701711}
    702712
Note: See TracChangeset for help on using the changeset viewer.