Title: Duplicate Notifications
Last modified: April 14, 2018

---

# Duplicate Notifications

 *  Resolved [shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/)
 * (@shemakeswebsites)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/duplicate-notifications-6/)
 * Hi, I’m having an issue with a duplicate notification that is being sent on a“
   pending” status of a custom type posting. My site is still in development stages
   so it’s not accessible by the public. Please help.
 * Thank you.

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/topic/duplicate-notifications-6/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/duplicate-notifications-6/page/2/?output_format=md)

 *  Thread Starter [shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/)
 * (@shemakeswebsites)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10180188)
 * Hello again, I think I figured something out. My theme adds another status : ‘
   pending approval’ to my posts. I think this is somehow causing a conflict. How
   do I get the plugin to recognized all status options available?
 * Thank you.
 *  Plugin Author [Jack – BNFW](https://wordpress.org/support/users/voltronik/)
 * (@voltronik)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10184743)
 * Hi [@shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/),
   
   Thanks for your message.
 * Custom post statuses aren’t available within BNFW yet unfortunately. At this 
   time, it’s limited to the notifications available. You should be able to use 
   the standard ‘pending’ status though, if that helps.
 *  Thread Starter [shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/)
 * (@shemakeswebsites)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10185032)
 * Yes, I am able to use the ‘pending’ status, but the problem is that two emails
   are being triggered. Any ideas? Not sure how I could get you my login credentials
   as there is no ‘private’ options for this forum.
 * Thank you for always being so prompt.
 *  Plugin Author [Jack – BNFW](https://wordpress.org/support/users/voltronik/)
 * (@voltronik)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10188663)
 * Hi [@shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/),
   
   How are you triggering the notifications? Is this via the WP Admin or via a front-
   end form?
 *  Thread Starter [shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/)
 * (@shemakeswebsites)
 * [8 years ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10234309)
 * Hi Jack,
 * I’m back. Unfortunately, it’s not been resolved.
 * So my user does not have publishing capabilities. The theme I’m using is using
   a modified version of WP Jobs, so it uses front-end submission options. Upon 
   submission, the post goes into pending status and is published by admin.
 * According to my email log, two emails are submitted to the author to notify them
   of the pending submission. They are triggered at the exact same time. When I 
   turn off better notifications, no emails are being sent – not even from my theme
   or any WP notifications.
 *  Plugin Author [Jack – BNFW](https://wordpress.org/support/users/voltronik/)
 * (@voltronik)
 * [8 years ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10234730)
 * Hi [@shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/),
   
   How are you triggering the notification? Are you using a front-end form or the
   WP Admin? If you’re triggering from a front-end form, can you please take a look
   at [this document](https://betternotificationsforwp.com/documentation/compatibility/support-plugins-front-end-forms/)
   and see if it helps?
 * Additionally, it might be worth installing the Post SMTP plugin to improve email
   delivery.
 * Let me know how you get on.
 *  Thread Starter [shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/)
 * (@shemakeswebsites)
 * [8 years ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10236870)
 * Hi, adding that snippet generates four emails. So it’s being duplicated again.
 * The theme I’m using is using a modified version of WP Jobs, so it uses front-
   end submission options. I also have SMPT setup.
 *  Plugin Author [Jack – BNFW](https://wordpress.org/support/users/voltronik/)
 * (@voltronik)
 * [8 years ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10241730)
 * Hi [@shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/),
   
   I think the issue is that the theme is conflicting, most likely due to a `wp_update_post`
   hook somewhere in there. I don’t think there’s anything we can do in this situation
   however because this hook doesn’t provide any post status transitions and so 
   won’t allow us to trigger notifications correctly.
 * The only two suggestions I have are:
    1. Try another theme 2. See if you can 
   modify the theme to fit your needs
 *  Thread Starter [shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/)
 * (@shemakeswebsites)
 * [8 years ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10256376)
 * Hello again. I have reported back to the theme author and this is what was suggested.
   Is this something that can be done to address the problem?
 * “I am not familiar with this plugin but if the problem is with wp_update_hook
   then the plugin author can use a global variable to store the updated post ids
   so he can stop the functionality if the hook is being triggered multiple times.”
 *  Plugin Author [Jack – BNFW](https://wordpress.org/support/users/voltronik/)
 * (@voltronik)
 * [8 years ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10257016)
 * Thanks [@shemakeswebsites](https://wordpress.org/support/users/shemakeswebsites/),
   
   Let me do some investigation and see what I can do.
 *  [wadethefade](https://wordpress.org/support/users/wadethefade/)
 * (@wadethefade)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10446497)
 * Just throwing my situation in here, as its the closest to my issue as I can find.
 * I want to create this plugin correctly, so I’m asking direction.
    I have a simple
   form (title, post, cat) and on $post I am literally only doing this:
 *     ```
       $post_status = "pending";
       $articleToPost = array(
       'post_title' => $post_title,
       'post_content' => $post_content,
       'post_category' => $cat,
       'post_status' => $post_status, 
       'post_type' => $post_type,);
       $theId = wp_insert_post($articleToPost); 
       ```
   
 * And I am getting two notifications. I’ve tried:
    `add_filter( 'bnfw_trigger_insert_post','
   __return_true' );`
 * I’ve even tried using `wp_update_post`
 * I’ve even tried doing manual post transitions using `wp_transition_post_status`
 * I’ve seen you mention not creating plugins right in previous duplicate email 
   threads, but what exactly is the correct way of adding an article to only generate
   one notification via a plugin?
 * Note: I do not get duplicates in admin.
 * I’ve been trying to pair this down to the bare minimum in order to figure it 
   out.
    -  This reply was modified 7 years, 11 months ago by [wadethefade](https://wordpress.org/support/users/wadethefade/).
    -  This reply was modified 7 years, 11 months ago by [wadethefade](https://wordpress.org/support/users/wadethefade/).
 *  Plugin Author [Jack – BNFW](https://wordpress.org/support/users/voltronik/)
 * (@voltronik)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10448364)
 * Hi [@wadethefade](https://wordpress.org/support/users/wadethefade/),
 * Can you try adding your code to a function and then adding `do_action( "{$old_status}
   _to_{$new_status}", $post );` at the end of the function (changing the old and
   new post status variables, of course) and seeing if this helps? You should be
   able to use `wp_insert_post` but this must be coupled with transitioning the 
   post through the correct statuses in order for BNFW to be able to trigger a notification
   for it.
 *  Plugin Author [Jack – BNFW](https://wordpress.org/support/users/voltronik/)
 * (@voltronik)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10448404)
 * [@wadethefade](https://wordpress.org/support/users/wadethefade/),
 * Perhaps something like this?
 *     ```
       function bnfw_add_post() {
           $post_status = "pending";
           $articleToPost = array(
               'post_title' => $post_title,
               'post_content' => $post_content,
               'post_category' => $cat,
               'post_status' => $post_status,
               'post_type' => $post_type,
           );
   
           $post_id = wp_insert_post($articleToPost);
           $post = get_post( $post_id );
   
           do_action( "draft_to_{$post_status}", $post );
       }
       ```
   
    -  This reply was modified 7 years, 11 months ago by [Jack - BNFW](https://wordpress.org/support/users/voltronik/).
 *  [wadethefade](https://wordpress.org/support/users/wadethefade/)
 * (@wadethefade)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10449769)
 * I think I tried something similar, but let me see about this. I know I’ve read
   that bnfw uses transition hooks to fire…
 * Oh I have also tried – inserting the post as draft with `wp_insert_post` and 
   then doing a `wp_update_post` that had this directly after it:
    `wp_transition_post_status('
   pending', $old_status, $postToStatus );`
 * And… I just tried your suggestion: nope, I expected to get a 2nd round of duplicates..
   but no change. I still get duplicate emails.
 *     ```
       $theId = wp_insert_post($articleToPost); 
       $postToTransition = get_post( $theId );
       do_action( "draft_to_{$post_status}", $postToTransition );
       ```
   
 *  [wadethefade](https://wordpress.org/support/users/wadethefade/)
 * (@wadethefade)
 * [7 years, 11 months ago](https://wordpress.org/support/topic/duplicate-notifications-6/#post-10449776)
 * WAIT.
 * THAT DID IT. I guess I had all the pieces but didn’t have them put together at
   the right times.
 * I also never thought about querying the post back out with `get_post` before 
   updating it.
 * This gives me a single notification:
 *     ```
       $articleToPost = array(
       'post_title' => $post_title,
       'post_content' => $post_content,
       'post_category' => $cat, 
       'post_status' => "draft", 
       'post_type' => $post_type 
       );
       $theId = wp_insert_post($articleToPost); 
       $postToTransition = get_post( $theId );
       wp_transition_post_status( 'pending', $post_status, $postToTransition );
       ```
   
 * Thanks for the prompt replies
    -  This reply was modified 7 years, 11 months ago by [wadethefade](https://wordpress.org/support/users/wadethefade/).

Viewing 15 replies - 1 through 15 (of 20 total)

1 [2](https://wordpress.org/support/topic/duplicate-notifications-6/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/duplicate-notifications-6/page/2/?output_format=md)

The topic ‘Duplicate Notifications’ is closed to new replies.

 * ![](https://ps.w.org/bnfw/assets/icon.svg?rev=2531573)
 * [Customize WordPress Emails and Alerts - Better Notifications for WP](https://wordpress.org/plugins/bnfw/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/bnfw/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/bnfw/)
 * [Active Topics](https://wordpress.org/support/plugin/bnfw/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/bnfw/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/bnfw/reviews/)

 * 20 replies
 * 3 participants
 * Last reply from: [Jack – BNFW](https://wordpress.org/support/users/voltronik/)
 * Last activity: [7 years, 10 months ago](https://wordpress.org/support/topic/duplicate-notifications-6/page/2/#post-10458909)
 * Status: resolved