LogoLogo
WordPress.orgExtensionsSupport
Version 6
Version 6
  • Notification – Custom Notifications and Alerts for WordPress
  • Known issues
  • User guide
    • How Notification plugin works
    • Who can use this plugin
    • How to create Notifications
    • Custom Post Type support
    • How to escape { character
    • Background processing
    • Troubleshooting
    • How to setup different FROM address for different Notifications
  • Developer
    • General
      • Plugin loading chain
      • Extension possibilities
      • Creating an extension
      • Bundling Notification plugin
      • White label mode
    • Notifications
      • Suppressing the Notification
      • JSON synchronization
      • Programmatic Notifications
    • Triggers
      • List of all default Triggers
      • Custom Trigger
      • Enable support for non-public Custom Post Type
      • Adding Merge Tags to existing Triggers
      • Postponing the Trigger action
      • Delaying Trigger execution with Cron
    • Carriers
      • Suppressing the Carrier
    • Snippets
      • General
        • Automatic Trigger testing
        • Allow other roles to edit Notifications
      • Triggers
        • Post
        • User
      • Integations
        • WP All Import
        • MemberPress
        • Gutenberg
  • Extensions
    • Installation
    • Planned extensions
    • 3rd Party Extensions
    • Custom Fields
    • Scheduled Triggers
Powered by GitBook
On this page
  • Default usage
  • Custom notifications directory

Was this helpful?

  1. Developer
  2. Notifications

JSON synchronization

Synchronize all the Notifications by saving them within the theme or plugin files.

This is very similar how Advanced Custom Fields JSON synchronization works. Whenever you save the notification in wp-admin the JSON file with all the config is saved within the directory you specified. It works the other way around as well - if you don't have the notification in your WordPress database, you can pull it from the file.

The notification is sent even if it's just in the file and not in the database, so you can import it just for editing purposes.

Default usage

if ( function_exists( 'notification_sync' ) ) {
    notification_sync();
}

You can put this code in your custom plugin or in your child theme's functions.php file.

Bu default, all the notification will be saved within the wp-content/themes/$theme/notifications/ directory.

Custom notifications directory

You can put the notifications in a custom directory if you like, just pass the full path in the parameter.

To put the notifications within the wp-content/uploads directory do it like this:

if ( function_exists( 'notification_sync' ) ) {
    $uploads_dir = wp_upload_dir();
    notification_sync( $uploads_dir['basedir'] );
}

The Notification plugin supports only one synchronization directory

PreviousSuppressing the NotificationNextProgrammatic Notifications

Last updated 5 years ago

Was this helpful?