get_block_file_template

get_block_file_template

Hook Type: filter
See hook in action

See hook in core

Displaying hooks found in version: wordpress-6.5.2

apply_filters('get_block_file_template') is found 4 times:

  • /wp-includes/block-template-utils.php line 1151

    $parts = explode( ‘//’, $id, 2 );
    if ( count( $parts ) < 2 ) { /** This filter is documented in wp-includes/block-template-utils.php */ return apply_filters( 'get_block_file_template', null, $id, $template_type ); } list( $theme, $slug ) = $parts; if ( get_stylesheet() !== $theme ) { /** This filter is documented in wp-includes/block-template-utils.php */ return apply_filters( 'get_block_file_template', null, $id, $template_type ); [/php]

  • /wp-includes/block-template-utils.php line 1157
    	list( $theme, $slug ) = $parts;
    
    	if ( get_stylesheet() !== $theme ) {
    		/** This filter is documented in wp-includes/block-template-utils.php */
    		return apply_filters( 'get_block_file_template', null, $id, $template_type );
    	}
    
    	$template_file = _get_block_template_file( $template_type, $slug );
    	if ( null === $template_file ) {
    		/** This filter is documented in wp-includes/block-template-utils.php */
    		return apply_filters( 'get_block_file_template', null, $id, $template_type );
    
  • /wp-includes/block-template-utils.php line 1163
     
    	$template_file = _get_block_template_file( $template_type, $slug );
    	if ( null === $template_file ) {
    		/** This filter is documented in wp-includes/block-template-utils.php */
    		return apply_filters( 'get_block_file_template', null, $id, $template_type );
    	}
    
    	$block_template = _build_block_template_result_from_file( $template_file, $template_type );
    
    	/**
    	 * Filters the block template object after it has been (potentially) fetched from the theme file.
    
  • /wp-includes/block-template-utils.php line 1177
    	 * @param WP_Block_Template|null $block_template The found block template, or null if there is none.
    	 * @param string                 $id             Template unique identifier (example: 'theme_slug//template_slug').
    	 * @param string                 $template_type  Template type. Either 'wp_template' or 'wp_template_part'.
    	 */
    	return apply_filters( 'get_block_file_template', $block_template, $id, $template_type );
    }
    
    /**
     * Prints a block template part.
     *
     * @since 5.9.0
    

See this hook used in plugins: