Pass back error if upload fails

This commit is contained in:
Kelly Dwan 2019-10-24 16:20:21 -04:00
parent 66772080a5
commit e279f9ba49
No known key found for this signature in database
GPG key ID: 8BA5575F3D11575D

View file

@ -131,9 +131,10 @@ function process_form_new() {
} }
$result = \media_handle_sideload( $logo, $new_pledge_id ); $result = \media_handle_sideload( $logo, $new_pledge_id );
if ( ! is_wp_error( $result ) ) { if ( is_wp_error( $result ) ) {
set_post_thumbnail( $new_pledge_id, $result ); return $result;
} }
set_post_thumbnail( $new_pledge_id, $result );
} }
return 'success'; return 'success';