• I am trying to implement the snippet you posted here:

    https://docs.bracketspace.com/notification/developer/triggers/adding-merge-tags-to-existing-triggers#global-merge-tags
    first in my theme’s functions.php file, then as a mu-plugin, but all I get when I reload the Notifications admin pages is:

    Fatal error: Uncaught Error: Class ‘BracketSpace\Notification\Register’ not found in /home/xxxxxxx/public_html/xxxxxxxxxx.org/wp-content/mu-plugins/notifications-global-mergetag.php:13

    What am I missing? Here is a generic version of my plugin. I tried it with and without the namespace declaration.

    <?php
    /**
    * Plugin Name: Global Merge Tag for Notifications
    * Description: Create global merge tag for Site Name
    * Author: BracketSpace
    */
    
    namespace MG2022notifications;
    
    use BracketSpace\Notification\Defaults\MergeTag\StringTag;
    use BracketSpace\Notification\Register;
    
    Register::global_merge_tag( new StringTag( [
    	'slug'     => 'site_name',
    	'name'     => 'Site Name',
    	'resolver' => function( $trigger ) {
    		return get_option( 'blogname', 'Website Name' );
    	},
    ] ) );
    

    Thanks in advance.

  • The topic ‘How to use global merge tags snippet?’ is closed to new replies.