Hooks

Hooks: Tags and Dynamic Data

4 min read

Notifal replaces {tag} placeholders in templates with live data from orders, products, users, posts, and custom meta. These hooks let you register tags, change resolved values, and extend dynamic key discovery in the admin and REST API.

Index: Hook Reference Hub. REST: /wp-json/notifal/v1/tags and /wp-json/notifal/v1/dynamic-keys in REST API Reference.

Walkthrough: Cookbook: Add Custom Dynamic Tag.

Notification-specific tag context: notifal/onpage/tag/context in Notifications and Eligibility.

Tag registration (actions)

HookParametersDescription
notifal/tag/registerTagManager $managerAfter default tags registered; register custom tags here
notifal/tag/manager/on_registeredTag $tagAfter a single tag is registered

Pro comment tags: notifal_pro/comment_tags/register and notifal_pro/comment_tags/registered in Pro Integration Bridge.

Tag resolution (actions)

HookParametersDescription
notifal/tag/before_resolveTag $tag, array $contextBefore a single tag value is resolved
notifal/tag/after_resolveTag $tag, string $value, array $contextAfter a single tag is resolved

TagManager batch rendering (actions)

HookParametersDescription
notifal/tag/manager/before_renderTagManager $tagManager, string $content, array $contextBefore all tags in content are processed
notifal/tag/manager/after_renderTagManager $tagManager, string $content, array $contextAfter all tags are replaced

Tag value and content modification (filters)

HookParametersDescription
notifal/tag/modify_valuestring $value, Tag $tag, array $contextOverride or adjust one tag's resolved value
notifal/tag/manager/modify_rendered_contentstring $content, array $contextFinal HTML after all tag replacements

Tag categories and REST (filters)

HookParametersDescription
notifal/tag/categoriesstring[] $categoriesAvailable tag category identifiers
notifal/tag/api/modify_responsearray $tagsTags grouped by category from REST API

Date tags (filters)

HookParametersDescription
notifal/tag/date/formatstring $dateFormat, string $tagKey, string $dateValueDate format string before formatting
notifal/tag/date/resultstring $formattedDate, string $dateFormat, string $tagKey, string $dateValueFinal formatted date string

Dynamic meta keys (filters)

Used when admins pick custom meta fields for dynamic tags.

HookParametersDescription
notifal/dynamic_keys/most_usedstring[] $keys, string $type, string $postTypeMost-used keys per entity type (user, order, product, custom_posttype)
notifal/dynamic_keys/search_resultsstring[] $keys, string $search, string $type, string $postTypeSearch results for meta key picker

WooCommerce product DTO (filter)

HookParametersDescription
notifal/woocommerce/product/dtoProductDTO $dto, WC_Product $wcProductProduct DTO after build, before use in tags/widgets

Post type discovery (filter)

HookParametersDescription
notifal/post_type_discovery/excluded_typesstring[] $excludedTypesPost types excluded from automatic tag discovery

Generated custom post type tags (actions)

Fired from settings when Pro-generated tags are saved (base plugin constants).

HookParametersDescription
notifal/generated_tags/savednoneGenerated tags saved in settings
notifal/generated_tags/removednoneGenerated tags removed from settings

Content source counter tags (filters)

These filters adjust cached counts used by {order_counter}, {product_counter}, and related tags.

HookParametersDescription
notifal/onpage/order_countint $count, array $content_source_settings, array $filtersFiltered order count
notifal/onpage/order_count/cache_timeoutint $timeout, array $content_source_settingsOrder count cache TTL (seconds)
notifal/onpage/product_countint $count, ...Product count
notifal/onpage/post_countint $count, ...Post count
notifal/onpage/page_countint $count, ...Page count
notifal/onpage/comment_countint $count, ...Comment count
notifal/onpage/custom_posttype_countint $count, ...Custom post type count
notifal/onpage/content_source_count/cache_timeoutint $timeout, ...Shared counter cache TTL

Comment count/pool resolution when Pro is active uses notifal_pro_get_comment_count and notifal_pro_fetch_comment_pool (Pro bridge).

Pool and entity filter hooks: Display Rules and Content Source.

Module services (filter)

HookParametersDescription
notifal/tags/servicesstring[] $servicesTags domain service class list

Hooks series

  1. Hook Reference Hub
  2. Hooks: Lifecycle and Bootstrap
  3. Hooks: Notifications and Eligibility
  4. Hooks: Templates and Rendering
  5. Hooks: Tags and Dynamic Data (you are here)
  6. Hooks: Display Rules and Content Source
  7. Hooks: Analytics and Tracking
  8. Hooks: Admin UI Extension
  9. Hooks: Pro Integration Bridge