WordPress.org

Make WordPress Core

Ticket #42578: 42578.3.diff

File 42578.3.diff, 3.2 KB (added by peterwilsoncc, 2 years ago)
  • src/wp-includes/default-filters.php

    diff --git a/src/wp-includes/default-filters.php b/src/wp-includes/default-filters.php
    index c1f6f673e1..53f1d7b247 100644
    a b foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 's 
    124124}
    125125
    126126// Format text area for display.
    127 foreach ( array( 'term_description', 'get_the_author_description', 'get_the_post_type_description' ) as $filter ) {
     127foreach ( array( 'term_description', 'get_the_post_type_description' ) as $filter ) {
    128128        add_filter( $filter, 'wptexturize' );
    129129        add_filter( $filter, 'convert_chars' );
    130130        add_filter( $filter, 'wpautop' );
  • src/wp-includes/general-template.php

    diff --git a/src/wp-includes/general-template.php b/src/wp-includes/general-template.php
    index ca2dbc02ec..a082aa05d0 100644
    a b function get_the_archive_description() { 
    15801580        if ( is_author() ) {
    15811581                $description = get_the_author_meta( 'description' );
    15821582        } elseif ( is_post_type_archive() ) {
    1583                 $description = get_the_post_type_description();
     1583                $post_type = get_query_var( 'post_type' );
     1584
     1585                if ( is_array( $post_type ) ) {
     1586                        $post_type = reset( $post_type );
     1587                }
     1588
     1589                $post_type_obj = get_post_type_object( $post_type );
     1590
     1591                // Check if a description is set.
     1592                if ( isset( $post_type_obj->description ) ) {
     1593                        $description = $post_type_obj->description;
     1594                } else {
     1595                        $description = '';
     1596                }
    15841597        } else {
    15851598                $description = term_description();
    15861599        }
  • tests/phpunit/tests/user/author.php

    diff --git a/tests/phpunit/tests/user/author.php b/tests/phpunit/tests/user/author.php
    index d8bdf37a39..669ff72d84 100644
    a b class Tests_User_Author_Template extends WP_UnitTestCase { 
    5656                $this->assertEquals( 'test_author', get_the_author_meta( 'user_login' ) );
    5757                $this->assertEquals( 'test_author', get_the_author_meta( 'display_name' ) );
    5858
    59                 $this->assertEquals( '<p>test_author</p>', trim( get_the_author_meta( 'description' ) ) );
     59                $this->assertEquals( 'test_author', trim( get_the_author_meta( 'description' ) ) );
    6060                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
    6161                add_user_meta( self::$author_id, 'user_description', 'user description' );
    6262                $this->assertEquals( 'user description', get_user_meta( self::$author_id, 'user_description', true ) );
    6363                // user_description in meta is ignored. The content of description is returned instead.
    6464                // See #20285
    6565                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
    66                 $this->assertEquals( '<p>test_author</p>', trim( get_the_author_meta( 'description' ) ) );
     66                $this->assertEquals( 'test_author', trim( get_the_author_meta( 'description' ) ) );
    6767                update_user_meta( self::$author_id, 'user_description', '' );
    6868                $this->assertEquals( '', get_user_meta( self::$author_id, 'user_description', true ) );
    6969                $this->assertEquals( 'test_author', get_the_author_meta( 'user_description' ) );
    70                 $this->assertEquals( '<p>test_author</p>', trim( get_the_author_meta( 'description' ) ) );
     70                $this->assertEquals( 'test_author', trim( get_the_author_meta( 'description' ) ) );
    7171
    7272                $this->assertEquals( '', get_the_author_meta( 'does_not_exist' ) );
    7373        }