WordPress.org

Make WordPress Core

Ticket #23399: wp_insert_attachment_data.diff

File wp_insert_attachment_data.diff, 1.2 KB (added by israelshirk, 14 months ago)

Patch to post.php with wp_insert_attachment_data filter similar to wp_insert_post_data filter.

  • wp-includes/post.php

     
    39063906 * @uses $user_ID 
    39073907 * @uses do_action() Calls 'edit_attachment' on $post_ID if this is an update. 
    39083908 * @uses do_action() Calls 'add_attachment' on $post_ID if this is not an update. 
     3909 * @uses apply_filters() Calls 'wp_insert_attachment_data' passing $data, $object prior to database update or insert. 
    39093910 * 
    39103911 * @param string|array $object Arguments to override defaults. 
    39113912 * @param string $file Optional filename. 
     
    40094010        $data = compact( array( 'post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_content_filtered', 'post_title', 'post_excerpt', 'post_status', 'post_type', 'comment_status', 'ping_status', 'post_password', 'post_name', 'to_ping', 'pinged', 'post_modified', 'post_modified_gmt', 'post_parent', 'menu_order', 'post_mime_type', 'guid' ) ); 
    40104011        $data = stripslashes_deep( $data ); 
    40114012 
     4013        $data = apply_filters('wp_insert_attachment_data', $data, $object); 
     4014 
    40124015        if ( $update ) { 
    40134016                $wpdb->update( $wpdb->posts, $data, array( 'ID' => $post_ID ) ); 
    40144017        } else {