Changeset 56819 for trunk/src/wp-includes/block-template-utils.php
- Timestamp:
- 10/10/2023 02:03:03 PM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-template-utils.php
r56805 r56819 725 725 * @since 5.9.0 726 726 * @since 6.3.0 Added `modified` property to template objects. 727 * @since 6.4.0 Added support for a revision post to be passed to this function. 727 728 * @access private 728 729 * … … 732 733 function _build_block_template_result_from_post( $post ) { 733 734 $default_template_types = get_default_block_template_types(); 734 $terms = get_the_terms( $post, 'wp_theme' ); 735 736 $post_id = wp_is_post_revision( $post ); 737 if ( ! $post_id ) { 738 $post_id = $post; 739 } 740 $parent_post = get_post( $post_id ); 741 742 $terms = get_the_terms( $parent_post, 'wp_theme' ); 735 743 736 744 if ( is_wp_error( $terms ) ) { … … 746 754 $has_theme_file = get_stylesheet() === $theme && null !== $template_file; 747 755 748 $origin = get_post_meta( $p ost->ID, 'origin', true );749 $is_wp_suggestion = get_post_meta( $p ost->ID, 'is_wp_suggestion', true );756 $origin = get_post_meta( $parent_post->ID, 'origin', true ); 757 $is_wp_suggestion = get_post_meta( $parent_post->ID, 'is_wp_suggestion', true ); 750 758 751 759 $template = new WP_Block_Template(); 752 760 $template->wp_id = $post->ID; 753 $template->id = $theme . '//' . $p ost->post_name;761 $template->id = $theme . '//' . $parent_post->post_name; 754 762 $template->theme = $theme; 755 763 $template->content = $post->post_content; … … 766 774 $template->modified = $post->post_modified; 767 775 768 if ( 'wp_template' === $p ost->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) {776 if ( 'wp_template' === $parent_post->post_type && $has_theme_file && isset( $template_file['postTypes'] ) ) { 769 777 $template->post_types = $template_file['postTypes']; 770 778 } 771 779 772 if ( 'wp_template' === $p ost->post_type && isset( $default_template_types[ $template->slug ] ) ) {780 if ( 'wp_template' === $parent_post->post_type && isset( $default_template_types[ $template->slug ] ) ) { 773 781 $template->is_custom = false; 774 782 } 775 783 776 if ( 'wp_template_part' === $p ost->post_type ) {777 $type_terms = get_the_terms( $p ost, 'wp_template_part_area' );784 if ( 'wp_template_part' === $parent_post->post_type ) { 785 $type_terms = get_the_terms( $parent_post, 'wp_template_part_area' ); 778 786 if ( ! is_wp_error( $type_terms ) && false !== $type_terms ) { 779 787 $template->area = $type_terms[0]->name; … … 782 790 783 791 // Check for a block template without a description and title or with a title equal to the slug. 784 if ( 'wp_template' === $p ost->post_type && empty( $template->description ) && ( empty( $template->title ) || $template->title === $template->slug ) ) {792 if ( 'wp_template' === $parent_post->post_type && empty( $template->description ) && ( empty( $template->title ) || $template->title === $template->slug ) ) { 785 793 $matches = array(); 786 794
Note: See TracChangeset
for help on using the changeset viewer.