Title: Add notifications programmatically
Last modified: January 8, 2022

---

# Add notifications programmatically

 *  Resolved [eelatfy](https://wordpress.org/support/users/eelatfy/)
 * (@eelatfy)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/add-notifications-programmatically/)
 * How to create custom notifications using code, any hook, or filters to add notifications?

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Plugin Author [wpdever](https://wordpress.org/support/users/wpdever/)
 * (@wpdever)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/add-notifications-programmatically/#post-15231989)
 * Hi,
 * When the custom action is triggered, you can store it in a new table or in an
   array in the user_meta table and use this function wnbell_update_user_count( 
   $user_id ) to increment the notification count.
 * To see this notification in the box, you can use these filter hooks:
    wnbell_user_notifications_array:
   to sort the notifications with the other user notifications before outputting
   them
 * wnbell_user_notifications_output : returns the html output of a notification 
   item you’ll see in the notification box
 * To change the css for seen notifications, you can use these hooks:
 * wnbell_add_unseen : when a user clicks on a notification, you can add its id 
   to an array of viewed notifications
 * wnbell_seen_data : to get the array of viewed notifications id for a particular
   user to use for the output
 *  [efinst0rm](https://wordpress.org/support/users/efinst0rm/)
 * (@efinst0rm)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/add-notifications-programmatically/#post-15373836)
 * Hi,
 * Are there any examples of this?
 *  Plugin Author [wpdever](https://wordpress.org/support/users/wpdever/)
 * (@wpdever)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/add-notifications-programmatically/#post-15375493)
 * Hi,
 * There are no examples, but you can check the includes/buddypress.php or includes/
   bbpress.php files in the plugin for an idea on how to save the notification.
 *  [efinst0rm](https://wordpress.org/support/users/efinst0rm/)
 * (@efinst0rm)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/add-notifications-programmatically/#post-15377825)
 * Hi,
 * Thank you! I was able to get it working on my end. Is there a hook for `wnbell_notification_list_menu`/`
   wnbell_notification_list`. Since I have to edit menu_bell.php and shortcode.php
   to get the custom notification to appear in the drop down.
 * Thanks
 *  Plugin Author [wpdever](https://wordpress.org/support/users/wpdever/)
 * (@wpdever)
 * [4 years, 3 months ago](https://wordpress.org/support/topic/add-notifications-programmatically/#post-15379080)
 * Hi,
 * This hook “wnbell_user_notifications_output” should be enough to get your notification
   to appear in the box. That’s the one I use for the addons and it’s in both the
   shortcode.php and outputs.php files.
 * It would be better to start a new topic if you need anything else, just in case
   the original poster keeps getting email notifications for every reply here.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Add notifications programmatically’ is closed to new replies.

 * ![](https://ps.w.org/wp-notification-bell/assets/icon-256x256.png?rev=2439614)
 * [WP Notification Bell](https://wordpress.org/plugins/wp-notification-bell/)
 * [Support Threads](https://wordpress.org/support/plugin/wp-notification-bell/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-notification-bell/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-notification-bell/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-notification-bell/reviews/)

 * 5 replies
 * 3 participants
 * Last reply from: [wpdever](https://wordpress.org/support/users/wpdever/)
 * Last activity: [4 years, 3 months ago](https://wordpress.org/support/topic/add-notifications-programmatically/#post-15379080)
 * Status: resolved