diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php index 535ed7261c..2dee4e2639 100644 --- a/src/wp-includes/default-filters.php +++ b/src/wp-includes/default-filters.php @@ -131,14 +131,14 @@ foreach ( array( 'content_save_pre', 'excerpt_save_pre', 'comment_save_pre', 'pr add_action( 'init', 'wp_init_targeted_link_rel_filters' ); // Format strings for display. -foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description', 'link_notes', 'bloginfo', 'wp_title', 'widget_title' ) as $filter ) { +foreach ( array( 'comment_author', 'term_name', 'link_name', 'link_description', 'link_notes', 'bloginfo', 'wp_title', 'document_title', 'widget_title' ) as $filter ) { add_filter( $filter, 'wptexturize' ); add_filter( $filter, 'convert_chars' ); add_filter( $filter, 'esc_html' ); } // Format WordPress. -foreach ( array( 'the_content', 'the_title', 'wp_title' ) as $filter ) { +foreach ( array( 'the_content', 'the_title', 'wp_title', 'document_title' ) as $filter ) { add_filter( $filter, 'capital_P_dangit', 11 ); } add_filter( 'comment_text', 'capital_P_dangit', 31 ); diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php index 6b67cd9a71..0b59b935d3 100644 --- a/src/wp-includes/general-template.php +++ b/src/wp-includes/general-template.php @@ -1238,10 +1238,15 @@ function wp_get_document_title() { $title = apply_filters( 'document_title_parts', $title ); $title = implode( " $sep ", array_filter( $title ) ); - $title = wptexturize( $title ); - $title = convert_chars( $title ); - $title = esc_html( $title ); - $title = capital_P_dangit( $title ); + + /** + * Filters the document title. + * + * @since 5.8.0 + * + * @param string $title Document title. + */ + $title = apply_filters( 'document_title', $title ); return $title; }