Posts, Post Types: Escape output within the_meta().

Convert markup to entities when displaying on the front end. Deprecates `the_meta()` in favor of `get_post_meta()`.

Props tykoted, martinkrcho, xknown, dd32, peterwilsoncc, paulkevan, timothyblynjacobs.

Built from https://develop.svn.wordpress.org/trunk@53958


git-svn-id: http://core.svn.wordpress.org/trunk@53517 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2022-08-30 15:15:09 +00:00
parent fa76bbbb0b
commit da3f89485a
2 changed files with 5 additions and 4 deletions

View File

@ -1090,9 +1090,10 @@ function post_custom( $key = '' ) {
* *
* @since 1.2.0 * @since 1.2.0
* *
* @internal This will probably change at some point... * @deprecated 6.0.2 Use get_post_meta() to retrieve post meta and render manually.
*/ */
function the_meta() { function the_meta() {
_deprecated_function( __FUNCTION__, '6.0.2', 'get_post_meta()' );
$keys = get_post_custom_keys(); $keys = get_post_custom_keys();
if ( $keys ) { if ( $keys ) {
$li_html = ''; $li_html = '';
@ -1108,8 +1109,8 @@ function the_meta() {
$html = sprintf( $html = sprintf(
"<li><span class='post-meta-key'>%s</span> %s</li>\n", "<li><span class='post-meta-key'>%s</span> %s</li>\n",
/* translators: %s: Post custom field name. */ /* translators: %s: Post custom field name. */
sprintf( _x( '%s:', 'Post custom field name' ), $key ), esc_html( sprintf( _x( '%s:', 'Post custom field name' ), $key ) ),
$value esc_html( $value )
); );
/** /**

View File

@ -16,7 +16,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '6.1-alpha-53957'; $wp_version = '6.1-alpha-53958';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.