Title: wp_before_load_template
Published: November 2, 2022
Last modified: February 24, 2026

---

# do_action( ‘wp_before_load_template’, string $_template_file, bool $load_once, array $args )

## In this article

 * [Parameters](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#parameters)
 * [Source](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#changelog)

[ Back to top](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#wp--skip-link--target)

Fires before a template file is loaded.

## 󠀁[Parameters](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#parameters)󠁿

 `$_template_file`string

The full path to the template file.

`$load_once`bool

Whether to require_once or require.

`$args`array

Additional arguments passed to the template.

## 󠀁[Source](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#source)󠁿

    ```php
    do_action( 'wp_before_load_template', $_template_file, $load_once, $args );
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-includes/template.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/6.9.4/src/wp-includes/template.php#L811)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/6.9.4/src/wp-includes/template.php#L811-L811)

## 󠀁[Related](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#related)󠁿

| Used by | Description | 
| [load_template()](https://developer.wordpress.org/reference/functions/load_template/)`wp-includes/template.php` |

Requires the template file with WordPress environment.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/hooks/wp_before_load_template/?output_format=md#changelog)󠁿

| Version | Description | 
| [6.1.0](https://developer.wordpress.org/reference/since/6.1.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Fhooks%2Fwp_before_load_template%2F)
before being able to contribute a note or feedback.