Skip to content

Commit 842f7f1

Browse files
Copilotswissspidy
andauthored
Fix --status=confirmed compat for WP < 5.7 in create()
Agent-Logs-Url: https://github.com/wp-cli/entity-command/sessions/23bdadcf-1412-48b9-a8b9-e2c3a8c6adb7 Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
1 parent de9bc03 commit 842f7f1

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

src/User_Privacy_Request_Command.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,17 @@ public function create( $args, $assoc_args ) {
233233
WP_CLI::error( $request_id );
234234
}
235235

236+
// The $status parameter for wp_create_user_request() was added in WP 5.7.0.
237+
// For older versions, manually update the post status when 'confirmed' was requested.
238+
if ( 'confirmed' === $status ) {
239+
wp_update_post(
240+
[
241+
'ID' => $request_id,
242+
'post_status' => 'request-confirmed',
243+
]
244+
);
245+
}
246+
236247
if ( Utils\get_flag_value( $assoc_args, 'send-email', false ) ) {
237248
wp_send_user_request( $request_id );
238249
}

0 commit comments

Comments
 (0)