diff --git a/includes/class-debug.php b/includes/class-debug.php index ee6a7e4..21e07f5 100644 --- a/includes/class-debug.php +++ b/includes/class-debug.php @@ -71,20 +71,16 @@ public static function log( $message, $type = 'string' ) { $file_path = WP_CONTENT_DIR . '/' . self::$log_file; - $content = $wp_filesystem->get_contents( $file_path ); - if ( false === $content ) { - $wp_filesystem->put_contents( - $file_path, - $formatted_message, - FS_CHMOD_FILE - ); - } else { - $wp_filesystem->put_contents( - $file_path, - $content . $formatted_message, - FS_CHMOD_FILE - ); + $content = ''; + if ( $wp_filesystem->exists( $file_path ) ) { + $content = $wp_filesystem->get_contents( $file_path ); } + + $wp_filesystem->put_contents( + $file_path, + $content . $formatted_message, + FS_CHMOD_FILE + ); } /**