is_wp_error() function give you authority to find error in media upload. Please see below example:

if ( is_wp_error( $attachment_id ) ) {
$errors = $attachment_id->get_error_messages();
foreach( $errors as $error ){
echo $error;
}
echo ‘There was an error uploading the image’;

}

Your Answer
Sign In
Enter email and password to comment or answer
Not the answer you are looking for? Browse other questions tagged or ask your own question.