Skip to content

Commit fddc7c6

Browse files
committed
fix(import): check post_type_exists on target blog
Verify the post type is registered on the target blog before inserting. Returns early if the post type does not exist, preventing silent failures. Closes #611
1 parent 1d0b575 commit fddc7c6

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

includes/ContentImport/ContentImporter.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,12 @@ protected function insert_blog_post( $blog_id, array $data = array() ) {
242242

243243
switch_to_blog( $blog_id );
244244

245+
if ( ! empty( $data['post_type'] ) && ! post_type_exists( $data['post_type'] ) ) {
246+
restore_current_blog();
247+
248+
return false;
249+
}
250+
245251
$this->handle( false );
246252
if ( isset( $data['ID'] ) ) {
247253
$post_id = wp_update_post( $data );

0 commit comments

Comments
 (0)