API / Hooks / rmHook

The API also allows you to remove hooks if you don't need them anymore, removing is very easy, it takes the same arguments as addHook but instead of adding it removes the hook from the list of hooks.

api::rmHook((int)$type, (string)$method, (string|object|array)$hook);

  • $type is the type of the hook which can be API_HOOK_AFTER, API_HOOK_BEFORE or API_HOOK_RETURN
  • $method is the name of the hooked to method that you want to remove, for e.g. 'posts::displayOne'
  • $hook is the hook that you want to remove

Example

api::rmHook(API_HOOK_BEFORE, 'pages::display', 'my_api_function');

This will remove the my_api_function from the API_HOOK_BEFORE list if found.