WordPress.org

Make WordPress Core

Ticket #40040: 40040.2.diff

File 40040.2.diff, 2.4 KB (added by henry.wright, 3 years ago)

get_the_post_type_description() seems a more appropriate name than get_the_post_type_archive_description(). 40040.2.diff changes the name of the new function.

  • src/wp-includes/default-filters.php

    diff --git src/wp-includes/default-filters.php src/wp-includes/default-filters.php
    index 9212e42..e689e1d 100644
    foreach ( array( 'single_post_title', 'single_cat_title', 'single_tag_title', 's 
    114114}
    115115
    116116// Format text area for display.
    117 foreach ( array( 'term_description', 'get_the_author_description' ) as $filter ) {
     117foreach ( array( 'term_description', 'get_the_author_description', 'get_the_post_type_description' ) as $filter ) {
    118118        add_filter( $filter, 'wptexturize'      );
    119119        add_filter( $filter, 'convert_chars'    );
    120120        add_filter( $filter, 'wpautop'          );
  • src/wp-includes/general-template.php

    diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
    index 087f47a..b9b6f9e 100644
    function get_the_archive_description() { 
    15541554        if ( is_author() ) {
    15551555                $description = get_the_author_meta( 'description' );
    15561556        } elseif ( is_post_type_archive() ) {
    1557                 $post_type = get_query_var( 'post_type' );
    1558 
    1559                 if ( is_array( $post_type ) ) {
    1560                         $post_type = reset( $post_type );
    1561                 }
    1562 
    1563                 $post_type_obj = get_post_type_object( $post_type );
    1564 
    1565                 // Check if a description is set.
    1566                 if ( isset( $post_type_obj->description ) ) {
    1567                         $description = $post_type_obj->description;
    1568                 } else {
    1569                         $description = '';
    1570                 }
     1557                $description = get_the_post_type_description();
    15711558        } else {
    15721559                $description = term_description();
    15731560        }
    function get_the_archive_description() { 
    15831570}
    15841571
    15851572/**
     1573 * Retrieves the post type description.
     1574 *
     1575 * @since 4.9.0
     1576 *
     1577 * @return string The post type description.
     1578 */
     1579function get_the_post_type_description() {
     1580
     1581        $post_type = get_query_var( 'post_type' );
     1582
     1583        if ( is_array( $post_type ) ) {
     1584                $post_type = reset( $post_type );
     1585        }
     1586
     1587        $post_type_obj = get_post_type_object( $post_type );
     1588
     1589        // Check if a description is set.
     1590        if ( isset( $post_type_obj->description ) ) {
     1591                $description = $post_type_obj->description;
     1592        } else {
     1593                $description = '';
     1594        }
     1595
     1596        /**
     1597         * Filters the post type description.
     1598         *
     1599         * @since 4.9.0
     1600         *
     1601         * @param string $description The post type description.
     1602         */
     1603        return apply_filters( 'get_the_post_type_description', $description );
     1604}
     1605
     1606/**
    15861607 * Retrieve archive link content based on predefined or custom code.
    15871608 *
    15881609 * The format can be one of four styles. The 'link' for head element, 'option'