Title: get_template_part
Published: May 7, 2019
Last modified: August 20, 2026

---

# do_action( ‘get_template_part’, string $slug, string $name, string[] $templates, array $args )

## In this article

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

Fires before an attempt is made to locate and load a template part.

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

 `$slug`string

The slug name for the generic template.

`$name`string

The name of the specialized template or an empty string if there is none.

`$templates`string[]

Array of template files to search for, in order.

`$args`array

Additional arguments passed to the template.

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

    ```php
    do_action( 'get_template_part', $slug, $name, $templates, $args );
    ```

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

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

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

Loads a template part into a template.

  |

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

| Version | Description | 
| [5.5.0](https://developer.wordpress.org/reference/since/5.5.0/) | The `$args` parameter was added. | 
| [5.2.0](https://developer.wordpress.org/reference/since/5.2.0/) | Introduced. |

## User Contributed Notes

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