groundhogg/post_merge_tags

πŸ“… Published on

πŸ“ Last updated

Documentation

Β»

Filter Hooks

Β»

groundhogg/post_merge_tags

Filters the list of available merge tags passed to the email block editor after the built-in tags have been registered. Use this to make your custom merge tags available in the editor’s tag picker.

apply_filters( 'groundhogg/post_merge_tags', $merge_tags, $props );

You will receive the current array of merge tag definitions and the block editor props array.

Example

add_filter( 'groundhogg/post_merge_tags', 'my_extension_register_editor_tags', 10, 2 );

/**
 * Add custom merge tags to the email block editor picker.
 *
 * @param array $merge_tags
 * @param array $props
 *
 * @return array
 */
function my_extension_register_editor_tags( $merge_tags, $props ) {
    $merge_tags[] = [
        'label' => 'Loyalty Points',
        'tag'   => '{loyalty_points}',
    ];

    return $merge_tags;
}

Was this helpful?

Let us know if this document answered your question. That’s the only way we can improve.