diff --git a/src/wp-includes/post.php b/src/wp-includes/post.php index b13942002a..7073328c0d 100644 --- a/src/wp-includes/post.php +++ b/src/wp-includes/post.php @@ -6162,7 +6162,7 @@ function wp_delete_attachment( $post_id, $force_delete = false ) { $backup_sizes = get_post_meta( $post->ID, '_wp_attachment_backup_sizes', true ); $file = get_attached_file( $post_id ); - if ( is_multisite() ) { + if ( is_multisite() && is_string( $file ) && ! empty( $file ) ) { clean_dirsize_cache( $file ); }