$image = get_post( $id );
if ( !$image || 'attachment' != $image->post_type || 'image/' != substr( $image->post_mime_type, 0, 6 ) ) {
- WP_CLI::warning( "FAILED: {$image->post_title} - invalid image ID" );
+ WP_CLI::warning( "{$image->post_title} - invalid image ID" );
return;
}
$fullsizepath = get_attached_file( $image->ID );
if ( false === $fullsizepath || !file_exists( $fullsizepath ) ) {
- WP_CLI::warning( "FAILED: {$image->post_title} - Can't find it $fullsizepath" );
+ WP_CLI::warning( "{$image->post_title} - Can't find it $fullsizepath" );
return;
}
$metadata = wp_generate_attachment_metadata( $image->ID, $fullsizepath );
if ( is_wp_error( $metadata ) ) {
- WP_CLI::line( $metadata->get_error_message() );
+ WP_CLI::warning( $metadata->get_error_message() );
return;
}
if ( empty( $metadata ) ) {
- WP_CLI::line( 'Unknown failure reason.' );
+ WP_CLI::warning( 'Unknown failure reason.' );
return;
}
wp_update_attachment_metadata( $image->ID, $metadata );