Skip to content

Commit c746132

Browse files
authored
FSE: Remove now-obsolete get_template_hierarchy() (#32116)
1 parent 412a2c1 commit c746132

File tree

1 file changed

+0
-29
lines changed

1 file changed

+0
-29
lines changed

lib/full-site-editing/template-loader.php

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -23,35 +23,6 @@ function gutenberg_add_template_loader_filters() {
2323

2424
add_action( 'wp_loaded', 'gutenberg_add_template_loader_filters' );
2525

26-
/**
27-
* Get the template hierarchy for a given template type.
28-
*
29-
* Internally, this filters into the "{$type}_template_hierarchy" hook to record the type-specific template hierarchy.
30-
*
31-
* @param string $template_type A template type.
32-
* @return string[] A list of template candidates, in descending order of priority.
33-
*/
34-
function get_template_hierarchy( $template_type ) {
35-
if ( ! in_array( $template_type, gutenberg_get_template_type_slugs(), true ) ) {
36-
return array();
37-
}
38-
39-
$get_template_function = 'get_' . str_replace( '-', '_', $template_type ) . '_template'; // front-page -> get_front_page_template.
40-
$template_hierarchy_filter = str_replace( '-', '', $template_type ) . '_template_hierarchy'; // front-page -> frontpage_template_hierarchy.
41-
42-
$result = array();
43-
$template_hierarchy_filter_function = function( $templates ) use ( &$result ) {
44-
$result = $templates;
45-
return $templates;
46-
};
47-
48-
add_filter( $template_hierarchy_filter, $template_hierarchy_filter_function, 20, 1 );
49-
call_user_func( $get_template_function ); // This invokes template_hierarchy_filter.
50-
remove_filter( $template_hierarchy_filter, $template_hierarchy_filter_function, 20 );
51-
52-
return $result;
53-
}
54-
5526
/**
5627
* Filters into the "{$type}_template" hooks to redirect them to the Full Site Editing template canvas.
5728
*

0 commit comments

Comments
 (0)