Site icon Hip-Hop Website Design and Development

How to overwrite the category template in a plugin

So I basically need to overwrite my category template in my child theme with the one in my plugin but I can’t seem to get it working.

I have checked the files paths and everything and there all correct this seems to be the way of doing it but again WordPress doesn’t seem to be using the template from my plugin.

add_filter( 'taxonomy_template', 'load_new_custom_tax_template');
function load_new_custom_tax_template ($tax_template) {
  if (is_category()) {
    $tax_template = dirname(  __FILE__  ) . '/category.php';
  }
  return $tax_template;
}