Skip to content

Commit 018be36

Browse files
swissspidyCopilot
andauthored
Update src/Media_Command.php
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent ba8050b commit 018be36

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/Media_Command.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,13 @@ public function replace( $args, $assoc_args = array() ) {
656656
array(
657657
'ID' => $attachment_id,
658658
'post_mime_type' => $new_mime_type,
659-
)
659+
),
660+
true
660661
);
661-
if ( is_wp_error( $updated ) ) {
662+
if ( false === $updated || is_wp_error( $updated ) ) {
663+
$message = is_wp_error( $updated ) ? $updated->get_error_message() : 'Unknown error.';
662664
WP_CLI::warning(
663-
sprintf( 'Failed to update MIME type for attachment %d: %s', $attachment_id, $updated->get_error_message() )
665+
sprintf( 'Failed to update MIME type for attachment %d: %s', $attachment_id, $message )
664666
);
665667
}
666668

0 commit comments

Comments
 (0)