Skip to content

Commit 792db98

Browse files
committed
ensure all existing buffers are closed before streaming the product feed file
1 parent a2c65a6 commit 792db98

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Feed/FeedBuilder/FeedBuilder.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,11 @@ public function render_feed( $lang = null ): void {
145145
wp_die( 'Feed generation launched' );
146146
}
147147

148+
// Close existing buffer before streaming feed content
149+
while ( ob_get_level() ) {
150+
ob_end_clean();
151+
}
152+
148153
header( 'Content-Type: application/xml; charset=utf-8' );
149154
header( 'Content-Length: ' . filesize( $file_path ) );
150155
nocache_headers();

0 commit comments

Comments
 (0)