I am new to wordpress development. I am familiar with joomla's ins-and-out working mechanish, now i want to contribute or say learn wordpress. I found that every thing in wordpress is done through plugin and its hooks and filters. But before diving into writing some cool stuffs, i want to know how hooks registered in plugin executes ? which design patterns is implemented in wordpress plugin environment ?
OK, lets take example.
add_action( 'wp_head', 'my_plg_function' );
function my_plg_function() {
echo 'I am called';
}
In above code, plugin's function is registered in wp_head hook, right ? Now what exactly does add_action function does and when wp_head hook runs, how my plugins function called ? Again I am new to this, i am trying to learn and create cool stuffs in wordpress. Any helps will be appreciated. Thanks