From 94ea1362339fa31569baff322640ae33a3134d0b Mon Sep 17 00:00:00 2001 From: Dion Hulse Date: Fri, 31 May 2024 15:32:07 +1000 Subject: [PATCH] WXR Import: Import posts as correct user --- packages/playground/blueprints/src/lib/steps/import-wxr.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/playground/blueprints/src/lib/steps/import-wxr.ts b/packages/playground/blueprints/src/lib/steps/import-wxr.ts index c3d6011f9b..87549daf56 100644 --- a/packages/playground/blueprints/src/lib/steps/import-wxr.ts +++ b/packages/playground/blueprints/src/lib/steps/import-wxr.ts @@ -46,7 +46,8 @@ export const importWxr: StepHandler> = async ( require ${phpVar(docroot)} . '/wp-admin/includes/image.php'; } kses_remove_filters(); - $admin_id = get_users(array('role' => 'Administrator') )[0]; + $admin_id = get_users(array('role' => 'Administrator') )[0]->ID; + wp_set_current_user( $admin_id ); $importer = new WXR_Importer( array( 'fetch_attachments' => true, 'default_author' => $admin_id