Make WordPress Core

Ticket #46420: 46420.2.diff

File 46420.2.diff, 1.8 KB (added by donmhico, 5 years ago)

Refresh the patch and apply the same solution on get_the_archive_title().

  • src/wp-includes/general-template.php

    diff --git src/wp-includes/general-template.php src/wp-includes/general-template.php
    index b116beb14e..af3d4af034 100644
    function get_the_archive_title() { 
    15961596                /* translators: Post type archive title. %s: Post type name */
    15971597                $title = sprintf( __( 'Archives: %s' ), post_type_archive_title( '', false ) );
    15981598        } elseif ( is_tax() ) {
    1599                 $tax = get_taxonomy( get_queried_object()->taxonomy );
    1600                 /* translators: Taxonomy term archive title. 1: Taxonomy singular name, 2: Current taxonomy term */
    1601                 $title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) );
     1599                $queried_object = get_queried_object();
     1600
     1601                if ( $queried_object ) {
     1602                        $tax = get_taxonomy( get_queried_object()->taxonomy );
     1603                        /* translators: Taxonomy term archive title. 1: Taxonomy singular name, 2: Current taxonomy term */
     1604                        $title = sprintf( __( '%1$s: %2$s' ), $tax->labels->singular_name, single_term_title( '', false ) );
     1605                }
     1606                else {
     1607                        $title = __( 'Not found' );
     1608                }
    16021609        } else {
    16031610                $title = __( 'Archives' );
    16041611        }
    function feed_links_extra( $args = array() ) { 
    29092916                }
    29102917        } elseif ( is_tax() ) {
    29112918                $term  = get_queried_object();
    2912                 $tax   = get_taxonomy( $term->taxonomy );
    2913                 $title = sprintf( $args['taxtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name, $tax->labels->singular_name );
    2914                 $href  = get_term_feed_link( $term->term_id, $term->taxonomy );
     2919
     2920                if ( $term ) {
     2921                        $tax   = get_taxonomy( $term->taxonomy );
     2922                        $title = sprintf( $args['taxtitle'], get_bloginfo( 'name' ), $args['separator'], $term->name, $tax->labels->singular_name );
     2923                        $href  = get_term_feed_link( $term->term_id, $term->taxonomy );
     2924                }
    29152925        } elseif ( is_author() ) {
    29162926                $author_id = intval( get_query_var( 'author' ) );
    29172927