diff --git a/projects/plugins/jetpack/changelog/fix-sitemap-backtick-column-names b/projects/plugins/jetpack/changelog/fix-sitemap-backtick-column-names new file mode 100644 index 000000000000..278ba9842697 --- /dev/null +++ b/projects/plugins/jetpack/changelog/fix-sitemap-backtick-column-names @@ -0,0 +1,4 @@ +Significance: patch +Type: bugfix + +Sitemaps: wrap column names in backticks to prevent SQL errors when a column name matches a MySQL reserved word. diff --git a/projects/plugins/jetpack/modules/sitemaps/sitemap-librarian.php b/projects/plugins/jetpack/modules/sitemaps/sitemap-librarian.php index a3544d81ea4f..da2900c99d0b 100644 --- a/projects/plugins/jetpack/modules/sitemaps/sitemap-librarian.php +++ b/projects/plugins/jetpack/modules/sitemaps/sitemap-librarian.php @@ -480,6 +480,6 @@ function ( $column ) { } ); - return implode( ',', array_map( 'esc_sql', $columns ) ); + return '`' . implode( '`,`', array_map( 'esc_sql', $columns ) ) . '`'; } }