WP hooks navigation: Home/browse • Actions index • Filters index
To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).
The best way to understand what a hook does is to look at where it occurs in the source code.
do_action( "hook_name" )apply_filters( "hook_name", "what_to_filter" ).Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.
This hook occurs 4 times in this file.
| Line | Code |
|---|---|
| 834 | */ |
| 835 | $block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type ); |
| 836 | if ( ! is_null( $block_template ) ) { |
| 837 | return $block_template; |
| 838 | } |
| 839 | |
| 840 | $parts = explode( '//', $id, 2 ); |
| 841 | if ( count( $parts ) < 2 ) { |
| 842 | /** This filter is documented in wp-includes/block-template-utils.php */ |
| 843 | return apply_filters( 'get_block_file_template', null, $id, $template_type ); |
| 844 | } |
| 845 | list( $theme, $slug ) = $parts; |
| 846 | |
| 847 | if ( wp_get_theme()->get_stylesheet() !== $theme ) { |
| 848 | /** This filter is documented in wp-includes/block-template-utils.php */ |
| 849 | return apply_filters( 'get_block_file_template', null, $id, $template_type ); |
| 850 | } |
| 851 | |
| 852 | $template_file = _get_block_template_file( $template_type, $slug ); |
| 853 | if ( null === $template_file ) { |
| 854 | /** This filter is documented in wp-includes/block-template-utils.php */ |
| 855 | return apply_filters( 'get_block_file_template', null, $id, $template_type ); |
| 856 | } |
| 857 | |
| 858 | $block_template = _build_block_template_result_from_file( $template_file, $template_type ); |
| 859 | |
| 860 | /** |
| 861 | * Filters the array of queried block templates array after they've been fetched. |
| 862 | * |
| 863 | * @since 5.9.0 |
| 864 | * |
| 865 | * @param WP_Block_Template|null $block_template The found block template, or null if there is none. |
| 866 | * @param string $id Template unique identifier (example: theme_slug//template_slug). |
| 867 | * @param string $template_type Template type: `'wp_template'` or '`wp_template_part'`. |
| 868 | */ |
| 869 | return apply_filters( 'get_block_file_template', $block_template, $id, $template_type ); |
| 870 | } |
| 871 | |
| 872 | /** |
| 873 | * Print a template-part. |
| 874 | * |
| 875 | * @since 5.9.0 |
| 876 | * |
| 877 | * @param string $part The template-part to print. Use "header" or "footer". |
| 878 | */ |