My intention was to make a pull request, but I'm having issues with my fork triggering headers already sent
on activation.
I gave up, deleted the fork, and will leave the tips here. Curiously, I used your technique in a plugin of mine without any glitches...
public function switching_theme( $new_name, $new_theme )
{
$old_theme = get_option( 'theme_switched' );
$template_path_app = get_theme_root( $old_theme ) . "/$old_theme/template-example.php";
if( file_exists( $template_path_app ) )
unlink( $template_path_app );
$this->register_project_template();
}
add_action( 'switch_theme', array( $this, 'switching_theme' ), 10, 2 );
// In the constructor
$this->plugin_slug = plugin_basename( __FILE__ );
public function refresh_template( $true, $hook_extra, $result ) {
if( isset( $hook_extra['plugin'] ) && $hook_extra['plugin'] == $this->plugin_slug ) {
$this->register_project_template();
$this->deregister_project_template();
}
return $true;
}
add_filter( 'upgrader_post_install', array( $this, 'refresh_template' ), 10, 3 );