hook_theme doesn’t get called

I was developing a new module in drupal and it needed a theme function to be implemented.

As per the instructions, it was implemented as follows (to use a template)

/**
 * Implementation of hook_theme().
 */
function my_module_results_theme($existing, $type, $theme, $path) {
 
	return array(
    	'my_block' => array(
    		'template' => 'my_block',
	 		'arguments' => array(
				'var1' => NULL
			)
		)
	);
}

However, when trying to apply the theme, it didn’t work. I tried various things and identified that the hook above was just not being called. A little bit of digging helped me discover that themes are cached. This happens even in the dev mode. To resolve this, go to

Administer  -> Performance -> Clear Cached Data (right at the bottom of the page)

and et voila my theme was now being utilised.

WordPress Themes