Make WordPress Core

Changeset 50011


Ignore:
Timestamp:
01/25/2021 12:08:02 AM (4 years ago)
Author:
pento
Message:

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.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/export.php

    r49910 r50011  
    543543                setup_postdata( $post );
    544544
    545                 /** This filter is documented in wp-includes/feed.php */
    546                 $title = apply_filters( 'the_title_rss', $post->post_title );
     545                /**
     546                 * Filters the post title used for WXR exports.
     547                 *
     548                 * @since 5.7.0
     549                 *
     550                 * @param string $post_title Title of the current post.
     551                 */
     552                $title = wxr_cdata( apply_filters( 'the_title_export', $post->post_title ) );
    547553
    548554                /**
Note: See TracChangeset for help on using the changeset viewer.