Changeset 54494
- Timestamp:
- 10/11/2022 05:28:54 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-template-utils.php
r54470 r54494 561 561 ); 562 562 $args = wp_parse_args( $args, $default_args ); 563 $posts = new WP_Query( $args );564 565 if ( empty( $posts ) ) {563 $posts_query = new WP_Query( $args ); 564 565 if ( empty( $posts_query->posts ) ) { 566 566 $template->title = sprintf( 567 567 /* translators: Custom template title in the Site Editor referencing a post that was not found. 1: Post type singular name, 2: Post type slug. */ … … 574 574 } 575 575 576 $post_title = $posts [0]->post_title;576 $post_title = $posts_query->posts[0]->post_title; 577 577 578 578 $template->title = sprintf( … … 592 592 'title' => $post_title, 593 593 ); 594 $args = wp_parse_args( $args, $default_args ); 595 596 $posts_with_same_title = new WP_Query( $args ); 597 598 if ( count( $posts_with_same_title ) > 1 ) { 594 $args = wp_parse_args( $args, $default_args ); 595 $posts_with_same_title_query = new WP_Query( $args ); 596 597 if ( count( $posts_with_same_title_query->posts ) > 1 ) { 599 598 $template->title = sprintf( 600 599 /* translators: Custom template title in the Site Editor. 1: Template title, 2: Post type slug. */ … … 636 635 'slug' => $slug, 637 636 ); 638 $args = wp_parse_args( $args, $default_args );639 $terms = $term_query->query( $args );640 641 if ( empty( $terms ) ) {637 $args = wp_parse_args( $args, $default_args ); 638 $terms_query = $term_query->query( $args ); 639 640 if ( empty( $terms_query->terms ) ) { 642 641 $template->title = sprintf( 643 642 /* translators: Custom template title in the Site Editor, referencing a taxonomy term that was not found. 1: Taxonomy singular name, 2: Term slug. */ … … 649 648 } 650 649 651 $term_title = $terms [0]->name;650 $term_title = $terms_query->terms[0]->name; 652 651 653 652 $template->title = sprintf( … … 670 669 'name' => $term_title, 671 670 ); 672 $args = wp_parse_args( $args, $default_args ); 673 674 $terms_with_same_title = $term_query->query( $args ); 675 676 if ( count( $terms_with_same_title ) > 1 ) { 671 $args = wp_parse_args( $args, $default_args ); 672 $terms_with_same_title_query = $term_query->query( $args ); 673 674 if ( count( $terms_with_same_title_query->terms ) > 1 ) { 677 675 $template->title = sprintf( 678 676 /* translators: Custom template title in the Site Editor. 1: Template title, 2: Term slug. */
Note: See TracChangeset
for help on using the changeset viewer.