Hook

Meaning – The term hook, refers to the location in a computer program where instruction is inserted for invoking a particular function.

A hook is a functionality provided by software for users of that software to have their own code called under certain circumstances. That code can augment or replace the current code.

A callback could be thought of as a specific kind of hook. By implementing callback functionality into a system, that system is letting you call some additional code after an action has completed. However, hooking (as a generic term) is not limited to callbacks.

One usage of hooks is in video game mod development. A game may not allow mod developers to extend base functionality, but hooks can be added by core mod library developers.

Example of usage“The Drupal CMS provides developers with hooks that let them take additional action after a “content node” is created. If a developer doesn’t implement a hook, the node is created per normal.”