From 7e93e2878456dbb3db2c3fcea8fcbd2572c348b6 Mon Sep 17 00:00:00 2001 From: Gary Pendergast Date: Mon, 25 Jan 2021 00:09:59 +0000 Subject: [PATCH] Export: Create an export-specific filter for post titles. Since WordPress 2.5 and 2.6, `post_content` and `post_excerpt` have both had export-specific filters: `the_content_export`, and `the_excerpt_export`, respectively. `post_title`, however, has used `the_title_rss`, which behaves differently in two important ways: - It strips HTML tags from the string. - It HTML-encodes the title string. These behaviours are not ideal for exports, since it changes the post title, resulting in data loss in export files, and incorrect post duplicate matching on import. This changes replaces the usage of `the_title_rss` with a new filter, `the_title_export`. The new filter is intended to be used in the same as `the_content_export` and `the_excerpt_export`. Props jmdodd, audrasjb. Fixes #52250. Built from https://develop.svn.wordpress.org/trunk@50011 git-svn-id: http://core.svn.wordpress.org/trunk@49712 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-admin/includes/export.php | 10 ++++++++-- wp-includes/version.php | 2 +- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/wp-admin/includes/export.php b/wp-admin/includes/export.php index 75c7b4924f..d33e2ffafb 100644 --- a/wp-admin/includes/export.php +++ b/wp-admin/includes/export.php @@ -542,8 +542,14 @@ function export_wp( $args = array() ) { foreach ( $posts as $post ) { setup_postdata( $post ); - /** This filter is documented in wp-includes/feed.php */ - $title = apply_filters( 'the_title_rss', $post->post_title ); + /** + * Filters the post title used for WXR exports. + * + * @since 5.7.0 + * + * @param string $post_title Title of the current post. + */ + $title = wxr_cdata( apply_filters( 'the_title_export', $post->post_title ) ); /** * Filters the post content used for WXR exports. diff --git a/wp-includes/version.php b/wp-includes/version.php index b447134fca..2d4b14088b 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -13,7 +13,7 @@ * * @global string $wp_version */ -$wp_version = '5.7-alpha-50010'; +$wp_version = '5.7-alpha-50011'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.