Documentation

Hooks: Actions and Filters

What are hooks?

Hooks allow you to change or run code without having to modify any existing files. They are used extensively in WordPress and are the backbone to how many plugins operate.

WordPress has two different types of hooks: actions and filters.

  • Action hooks allow you to insert (or run) code at various points.
  • Filter hooks allow you to take a variable and manipulate it before returning it to original point that it came from.

Using hooks

There are a couple of different ways that you can use a hook to add your own custom code:

  1. The first way is by adding the code to the functions.php file of your custom child theme.
  2. The second way is by using a plugin like Code Snippets.

If you would like to read more about Hooks, please see the WordPress Plugin Handbook on Hooks.

Action Hook Reference

HookTypeDescription
hey_notify_add_action_{$type}actionAdd actions to this Event Type.
hey_notify_send_message_{$service}actionTriggers a service to process a message.
hey_notify_message_sentactionRuns after a message is sent/processed.

Filter Hook Reference

HookTypeDescription
hey_notify_event_typesfilterFilter the Event Types dropdown options.
hey_notify_event_actionsfilterFilter the Event Actions dropdown options.
hey_notify_service_fieldsfilterFilter the service fields to add your own settings.
hey_notify_services_optionsfilterFilter the service options to add a new service.
hey_notify_settings_generalfilterFilter the General settings.
hey_notify_settings_uninstallfilterFilter the Uninstall settings.
hey_notify_slack_settings_{$trigger}filterRetrieves the service settings. Hey Notify’s $trigger is ‘core’.
hey_notify_discord_settings_{$trigger}filterRetrieves the service settings. Hey Notify’s $trigger is ‘core’.
hey_notify_email_settings_{$trigger}filterRetrieves the service settings. Hey Notify’s $trigger is ‘core’.
hey_notify_comment_new_subjectfilterFilter the New Comment notification subject.
hey_notify_cpt_draft_subjectfilterFilter the Custom Post Type Draft notification subject.
hey_notify_cpt_published_subjectfilterFilter the Custom Post Type Published notification subject.
hey_notify_cpt_scheduled_subjectfilterFilter the Custom Post Type Scheduled notification subject.
hey_notify_cpt_pending_subjectfilterFilter the Custom Post Type Pending notification subject.
hey_notify_cpt_updated_subjectfilterFilter the Custom Post Type Updated notification subject.
hey_notify_cpt_trashed_subjectfilterFilter the Custom Post Type Trashed notification subject.
hey_notify_page_draft_subjectfilterFilter the Page Draft notification subject.
hey_notify_page_published_subjectfilterFilter the Page Published notification subject.
hey_notify_page_scheduled_subjectfilterFilter the Page Scheduled notification subject.
hey_notify_page_pending_subjectfilterFilter the Page Pending notification subject.
hey_notify_page_updated_subjectfilterFilter the Page Updated notification subject.
hey_notify_page_trashed_subjectfilterFilter the Page Trashed notification subject.
hey_notify_post_draft_subjectfilterFilter the Post Draft notification subject.
hey_notify_post_published_subjectfilterFilter the Post Published notification subject.
hey_notify_post_scheduled_subjectfilterFilter the Post Scheduled notification subject.
hey_notify_post_pending_subjectfilterFilter the Post Pending notification subject.
hey_notify_post_updated_subjectfilterFilter the Post Updated notification subject.
hey_notify_post_trashed_subjectfilterFilter the Post Trashed notification subject.
hey_notify_system_core_update_subjectfilterFilter the WordPress Update notification subject.
hey_notify_system_theme_update_subjectfilterFilter the Theme Update notification subject.
hey_notify_system_plugin_update_subjectfilterFilter the Plugin Update notification subject.
hey_notify_system_plugin_activated_subjectfilterFilter the Plugin Activated notification subject.
hey_notify_system_plugin_deactivated_subjectfilterFilter the Plugin Deactivated notification subject.
hey_notify_system_theme_changed_subjectfilterFilter the Theme Changed notification subject.
hey_notify_user_new_subjectfilterFilter the New User notification subject.
hey_notify_user_admin_login_subjectfilterFilter the Administrator Login notification subject.
hey_notify_user_admin_login_failed_subjectfilterFilter the Administrator Login Failed notification subject.