Make WordPress Core

Changeset 56330

Timestamp:
08/01/2023 04:22:42 AM (12 months ago)
Author:
isabel_brison
Message:

Editor: fix duplication in templates list.

Excludes parent template when a child template is defined during template retrieval.

Props oandregal, mukesh27, flixos90, bgardner, peterwilsoncc.
Reviewed by peterwilsoncc.
Merges [56329] to the 6.3 branch.
Fixes #57756.

Location:
branches/6.3
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/6.3

  • branches/6.3/src/wp-includes/block-template-utils.php

    r56288 r56330  
    361361            }
    362362
     363
     364
     365
     366
     367
     368
     369
     370
    363371            $new_template_item = array(
    364372                'slug'  => $template_slug,
     
    371379                $candidate = _add_block_template_part_area_info( $new_template_item );
    372380                if ( ! isset( $area ) || ( isset( $area ) && $area === $candidate['area'] ) ) {
    373                     $template_files[] = $candidate;
     381                    $template_files[] = $candidate;
    374382                }
    375383            }
     
    381389                    ( $post_type && isset( $candidate['postTypes'] ) && in_array( $post_type, $candidate['postTypes'], true ) )
    382390                ) {
    383                     $template_files[] = $candidate;
     391                    $template_files[] = $candidate;
    384392                }
    385393            }
     
    387395    }
    388396
    389     return $template_files;
     397    return ;
    390398}
    391399
Note: See TracChangeset for help on using the changeset viewer.