feat: import media metadata records
This commit is contained in:
@@ -963,6 +963,10 @@ if ( ! function_exists( 'wp_insert_attachment' ) ) {
|
||||
* @return int|\WP_Error
|
||||
*/
|
||||
function wp_insert_attachment( array $args, $file = false, $parent_post_id = 0, $wp_error = false ) {
|
||||
if ( empty( $args['post_mime_type'] ) ) {
|
||||
return $wp_error ? new WP_Error( 'invalid_attachment_mime_type', 'Attachment mime type is required.' ) : 0;
|
||||
}
|
||||
|
||||
$GLOBALS['wpcs_test_attachment_files'][] = $file;
|
||||
$args['post_type'] = 'attachment';
|
||||
$args['post_parent'] = (int) $parent_post_id;
|
||||
|
||||
Reference in New Issue
Block a user