Skip to content

Commit fdd9b15

Browse files
committed
Use the already loaded comment meta in the WXR formatter
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01D26yjkN2BiqCXT6p6o1WqS
1 parent 81abe8a commit fdd9b15

1 file changed

Lines changed: 4 additions & 1 deletion

File tree

‎src/WP_Export_WXR_Formatter.php‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -288,7 +288,10 @@ protected function terms( $terms ) {
288288

289289
protected function comment_meta( $comment ) {
290290
global $wpdb;
291-
$metas = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $comment->comment_ID ) );
291+
// The export query already loads the comment meta, see WP_Export_Query::exportify_post().
292+
$metas = isset( $comment->meta ) && is_array( $comment->meta )
293+
? $comment->meta
294+
: $wpdb->get_results( $wpdb->prepare( "SELECT * FROM $wpdb->commentmeta WHERE comment_id = %d", $comment->comment_ID ) );
292295
if ( ! $metas ) {
293296
return new Oxymel();
294297
}

0 commit comments

Comments
 (0)