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 |
---|---|
1129 | */ |
1130 | $block_template = apply_filters( 'pre_get_block_file_template', null, $id, $template_type ); |
1131 | if ( ! is_null( $block_template ) ) { |
1132 | return $block_template; |
1133 | } |
1134 |
|
1135 | $parts = explode( '//', $id, 2 ); |
1136 | if ( count( $parts ) < 2 ) { |
1137 | /** This filter is documented in wp-includes/block-template-utils.php */ |
1138 | return apply_filters( 'get_block_file_template', null, $id, $template_type ); |
1139 | } |
1140 | list( $theme, $slug ) = $parts; |
1141 |
|
1142 | if ( get_stylesheet() !== $theme ) { |
1143 | /** This filter is documented in wp-includes/block-template-utils.php */ |
1144 | return apply_filters( 'get_block_file_template', null, $id, $template_type ); |
1145 | } |
1146 |
|
1147 | $template_file = _get_block_template_file( $template_type, $slug ); |
1148 | if ( null === $template_file ) { |
1149 | /** This filter is documented in wp-includes/block-template-utils.php */ |
1150 | return apply_filters( 'get_block_file_template', null, $id, $template_type ); |
1151 | } |
1152 |
|
1153 | $block_template = _build_block_template_result_from_file( $template_file, $template_type ); |
1154 |
|
1155 | /** |
1156 | * Filters the block template object after it has been (potentially) fetched from the theme file. |
1157 | * |
1158 | * @since 5.9.0 |
1159 | * |
1160 | * @param WP_Block_Template|null $block_template The found block template, or null if there is none. |
1161 | * @param string $id Template unique identifier (example: 'theme_slug//template_slug'). |
1162 | * @param string $template_type Template type: 'wp_template' or 'wp_template_part'. |
1163 | */ |
1164 | return apply_filters( 'get_block_file_template', $block_template, $id, $template_type ); |
1165 | } |
1166 |
|
1167 | /** |
1168 | * Prints a block template part. |
1169 | * |
1170 | * @since 5.9.0 |
1171 | * |
1172 | * @param string $part The block template part to print. Use "header" or "footer". |
1173 | */ |