Changeset 56060
- Timestamp:
- 06/27/2023 10:13:07 AM (16 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/block-template.php
r55988 r56060 7 7 8 8 /** 9 * Adds necessary filters to use 'wp_template' posts instead of theme template files.9 * Adds necessary hooks to resolve '_wp-find-template' requests. 10 10 * 11 11 * @access private … … 13 13 */ 14 14 function _add_template_loader_filters() { 15 if ( ! current_theme_supports( 'block-templates' ) ) { 16 return; 17 } 18 19 $template_types = array_keys( get_default_block_template_types() ); 20 foreach ( $template_types as $template_type ) { 21 // Skip 'embed' for now because it is not a regular template type. 22 if ( 'embed' === $template_type ) { 23 continue; 24 } 25 add_filter( str_replace( '-', '', $template_type ) . '_template', 'locate_block_template', 20, 3 ); 26 } 27 28 // Request to resolve a template. 29 if ( isset( $_GET['_wp-find-template'] ) ) { 15 if ( isset( $_GET['_wp-find-template'] ) && current_theme_supports( 'block-templates' ) ) { 30 16 add_action( 'pre_get_posts', '_resolve_template_for_new_post' ); 31 17 }
Note: See TracChangeset
for help on using the changeset viewer.