comments_template

Filters the path to the theme template file used for the comments template.

Description

apply_filters( 'comments_template', (string) $theme_template ); 

Parameters (1)

0. $theme_template (string)
The path to the theme template file.

Usage

To run the hook, copy the example below.
  1. $theme_template = apply_filters( 'comments_template', $theme_template ); 
  2.  
  3. if ( !empty( $theme_template ) ) { 
  4.  
  5. // everything has led up to this point... 
  6.  
  7.  
The following example is for adding a hook callback.
  1. // define the comments_template callback 
  2. function filter_comments_template( $theme_template ) { 
  3. // make filter magic happen here... 
  4. return $theme_template
  5. }; 
  6.  
  7. // add the filter 
  8. add_filter( 'comments_template', 'filter_comments_template', 10, 1 ); 
To remove a hook callback, use the example below.
  1. // remove the filter 
  2. remove_filter( 'comments_template', 'filter_comments_template', 10, 1 ); 

Defined (1)

The filter is defined in the following location(s).

/wp-includes/comment-template.php  
  1. $include = apply_filters( 'comments_template', $theme_template );