feat: import media metadata records

This commit is contained in:
Keith Solomon
2026-05-01 14:57:10 -05:00
parent 592e6e7403
commit 425d42e4bb
3 changed files with 518 additions and 0 deletions
+4
View File
@@ -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;