Fix check during install to create placeholder image.

This commit is contained in:
Mike Jolley 2019-01-14 11:32:57 +00:00
parent a7463c5535
commit 510ed70d1e
1 changed files with 7 additions and 6 deletions

View File

@ -1127,12 +1127,13 @@ CREATE TABLE {$wpdb->prefix}woocommerce_termmeta (
private static function create_placeholder_image() {
$placeholder_image = get_option( 'woocommerce_placeholder_image', 0 );
if ( ! is_numeric( $placeholder_image ) ) {
return;
}
if ( ! empty( $placeholder_image ) && is_numeric( $placeholder_image ) && wp_attachment_is_image( $placeholder_image ) ) {
return;
// Validate current setting if set. If set, return.
if ( ! empty( $placeholder_image ) ) {
if ( ! is_numeric( $placeholder_image ) ) {
return;
} elseif ( $placeholder_image && wp_attachment_is_image( $placeholder_image ) ) {
return;
}
}
$upload_dir = wp_upload_dir();