comments_template WordPress Filter Hook
The comments_template hook is used to load the comments template. This hook is used by the comments_template() function. The function has the following signature: comments_template( $file, $separate_comments ); The $file parameter is the path to the comments template. The $separate_comments parameter is a boolean value that determines whether the comments are displayed in a separate template. The comments_template hook is called in the following situations: When the comments_template() function is called When the wp_comments_template() function is called When the comments_array() function is called When the get_comments() function is called This hook is useful for loading a custom comments template.
apply_filters( 'comments_template', string $theme_template ) #
Filters the path to the theme template file used for the comments template.
Parameters
- $theme_template
(string)The path to the theme template file.
More Information
The comments_template
filter can be used to load a custom template form a plugin which replaces the theme’s default comment template.
Source
Changelog
Version | Description |
---|---|
1.5.1 | Introduced. |