How do I pass arguments to add_action? I wanted to create an array of hooks, and then setup add_action calls to each array item like:
$hook_array = array('publish_page','trash_page');
foreach($hook_array as $hook)
{
add_action($hook, 'my_function');
}
But this doesn't allow me to do anything within my_function based on the hook that was called. I know I could create individual functions and then tailor each one to the hook it works with, but then I'd be needlessly duplicating code and the more hooks I add to my hook array the more the code would grow.