Menu Adam R Brown

WP hooks navigation: Home/browseActions indexFilters index

Source View: pre_get_block_file_template

To save our bandwidth, we show only a snippet of code around each occurence of the hook. View complete file in SVN (without highlighting).

Understanding Source Code

The best way to understand what a hook does is to look at where it occurs in the source code.

Remember, this hook may occur in more than one file. Moreover, the hook's context may change from version to version.

Source View

Line Code
826       * Return a non-null value to bypass the WordPress queries.
827       *
828       * @since 5.9.0
829       *
830       * @param WP_Block_Template|null $block_template Return block template object to short-circuit the default query,
831       *                                               or null to allow WP to run its normal queries.
832       * @param string                 $id             Template unique identifier (example: theme_slug//template_slug).
833       * @param string                 $template_type  Template type: `'wp_template'` or '`wp_template_part'`.
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      }