Add a filter `wp_insert_attachment_data` in `wp_insert_attachment()`. This is similar to the `wp_insert_post_data` filter in `wp_insert_post()`.
Fixes #20547. Built from https://develop.svn.wordpress.org/trunk@27130 git-svn-id: http://core.svn.wordpress.org/trunk@26997 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
53867f3081
commit
cbc1b90633
|
@ -4093,6 +4093,7 @@ function wp_insert_attachment($object, $file = false, $parent = 0) {
|
||||||
|
|
||||||
// expected_slashed (everything!)
|
// expected_slashed (everything!)
|
||||||
$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' ) );
|
$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' ) );
|
||||||
|
$data = apply_filters( 'wp_insert_attachment_data', $data, $object );
|
||||||
$data = wp_unslash( $data );
|
$data = wp_unslash( $data );
|
||||||
|
|
||||||
if ( $update ) {
|
if ( $update ) {
|
||||||
|
|
Loading…
Reference in New Issue