comments_template
Filter HookDescription
Filters the path to the theme template file used for the comments template.Hook Information
File Location |
wp-includes/comment-template.php
View on GitHub
|
Hook Type | Filter |
Line Number | 1626 |
Hook Parameters
Type | Name | Description |
---|---|---|
string
|
$theme_template
|
The path to the theme template file. |
Usage Examples
Basic Usage
<?php
// Hook into comments_template
add_filter('comments_template', 'my_custom_filter', 10, 1);
function my_custom_filter($theme_template) {
// Your custom filtering logic here
return $theme_template;
}
Source Code Context
wp-includes/comment-template.php:1626
- How this hook is used in WordPress core
<?php
1621 *
1622 * @since 1.5.1
1623 *
1624 * @param string $theme_template The path to the theme template file.
1625 */
1626 $include = apply_filters( 'comments_template', $theme_template );
1627
1628 if ( file_exists( $include ) ) {
1629 require $include;
1630 } elseif ( file_exists( trailingslashit( $wp_template_path ) . $file ) ) {
1631 require trailingslashit( $wp_template_path ) . $file;
PHP Documentation
<?php
/**
* Filters the path to the theme template file used for the comments template.
*
* @since 1.5.1
*
* @param string $theme_template The path to the theme template file.
*/
Quick Info
- Hook Type: Filter
- Parameters: 1
- File: wp-includes/comment-template.php
Related Hooks
Related hooks will be displayed here in future updates.