Changeset 54445
- Timestamp:
- 10/10/2022 03:15:31 PM (2 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-template-utils.php
r54380 r54445 547 547 $post_type_object = get_post_type_object( $post_type ); 548 548 549 $posts = get_posts( 550 array( 551 'name' => $slug, 552 'post_type' => $post_type, 553 ) 554 ); 549 $default_args = array( 550 'post_type' => $post_type, 551 'post_status' => 'publish', 552 'posts_per_page' => 1, 553 'update_post_meta_cache' => false, 554 'update_post_term_cache' => false, 555 'ignore_sticky_posts' => true, 556 'no_found_rows' => true, 557 ); 558 559 $args = array( 560 'name' => $slug, 561 ); 562 $args = wp_parse_args( $args, $default_args ); 563 $posts = new WP_Query( $args ); 555 564 556 565 if ( empty( $posts ) ) { … … 580 589 ); 581 590 582 $posts_with_same_title = get_posts( 583 array( 584 'title' => $post_title, 585 'post_type' => $post_type, 586 'post_status' => 'publish', 587 ) 588 ); 591 $args = array( 592 'title' => $post_title, 593 ); 594 $args = wp_parse_args( $args, $default_args ); 595 596 $posts_with_same_title = new WP_Query( $args ); 589 597 590 598 if ( count( $posts_with_same_title ) > 1 ) { … … 616 624 $taxonomy_object = get_taxonomy( $taxonomy ); 617 625 618 $terms = get_terms( 619 array( 620 'taxonomy' => $taxonomy, 621 'hide_empty' => false, 622 'slug' => $slug, 623 ) 624 ); 626 $default_args = array( 627 'taxonomy' => $taxonomy, 628 'hide_empty' => false, 629 'update_term_meta_cache' => false, 630 ); 631 632 $term_query = new WP_Term_Query(); 633 634 $args = array( 635 'number' => 1, 636 'slug' => $slug, 637 ); 638 $args = wp_parse_args( $args, $default_args ); 639 $terms = $term_query->query( $args ); 625 640 626 641 if ( empty( $terms ) ) { … … 649 664 ); 650 665 651 $terms_with_same_title = get_terms( 652 array( 653 'taxonomy' => $taxonomy, 654 'hide_empty' => false, 655 'name' => $term_title, 656 ) 657 ); 666 $term_query = new WP_Term_Query(); 667 668 $args = array( 669 'number' => 2, 670 'name' => $term_title, 671 ); 672 $args = wp_parse_args( $args, $default_args ); 673 674 $terms_with_same_title = $term_query->query( $args ); 658 675 659 676 if ( count( $terms_with_same_title ) > 1 ) {
Note: See TracChangeset
for help on using the changeset viewer.