Title: Replacing/Overriding comments_template() from plugin
Last modified: August 21, 2016

---

# Replacing/Overriding comments_template() from plugin

 *  [unity100](https://wordpress.org/support/users/unity100/)
 * (@unity100)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/replacingoverriding-comments_template-from-plugin/)
 * Hi people,
 * i researched quite a bit but couldnt find an answer for this :
 * I want to replace the comment template of the theme (comments.php or whichever
   it is using) totally with my own function or comments.php in plugin.
 * In short, i want to totally override the theme’s entire commenting template.
 * I was able to find this recommendation in stack exchange for this :
 *  add_filter( “comments_template”, “my_custom_function”,0 );
 * However, this just filters the function, and my function just runs before comments_template,
   leading comments_template to STILL run after itself and load up the commenting
   template from the theme.
 * What should i use to accomplish this ?

Viewing 1 replies (of 1 total)

 *  Thread Starter [unity100](https://wordpress.org/support/users/unity100/)
 * (@unity100)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/replacingoverriding-comments_template-from-plugin/#post-4716031)
 * Never mind i found it by examining other plugins :
 * After overriding it with
 * add_filter( “comments_template”, “my_custom_function”,0 );
 * your function must return a comments.php from whever yo pick :
 * return dirname(__FILE__) . ‘/comments.php’;
 * this overrides comments totally.

Viewing 1 replies (of 1 total)

The topic ‘Replacing/Overriding comments_template() from plugin’ is closed to new
replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [comments_template](https://wordpress.org/support/topic-tag/comments_template/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 1 participant
 * Last reply from: [unity100](https://wordpress.org/support/users/unity100/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/replacingoverriding-comments_template-from-plugin/#post-4716031)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
