Title: Emails Problem
Last modified: October 12, 2021

---

# Emails Problem

 *  [pmmungai86](https://wordpress.org/support/users/pmmungai86/)
 * (@pmmungai86)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/emails-problem-2/)
 * I have a problem with the website, once a user posts an ad, an email is automatically
   sent indicating the ad has been published but it is still in moderation, instead
   of pending moderation, what could be the problem?
 * [https://gido.website](https://gido.website)
 * The page I need help with: _[[log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fwordpress.org%2Fsupport%2Ftopic%2Femails-problem-2%2F%3Foutput_format%3Dmd&locale=en_US)
   to see the link]_

Viewing 1 replies (of 1 total)

 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/emails-problem-2/#post-14961413)
 * This most likely has to do with this thread [https://wordpress.org/support/topic/moderate-6/](https://wordpress.org/support/topic/moderate-6/)
 * Try changing the code to something like that
 *     ```
       add_action( "template_redirect", function( $tpl ) {
           if( adverts_request( "_adverts_action" ) != "save" ) {
               return $tpl;
           }
   
           include_once ADVERTS_PATH . "includes/class-shortcode-adverts-add.php";
   
           $shortcode = new Adverts_Shortcode_Adverts_Add();
           $shortcode->load_args_from_checksum();
           $shortcode->init();
           $post_id = $shortcode->get_post_id();
           $post_id_nonce = $shortcode->get_post_id_nonce();
   
           if( $post_id > 0 && ! wp_verify_nonce( $post_id_nonce, "wpadverts-publish-" . $post_id ) ) {
               return $tpl;
           } 
           if( $shortcode->get_post_id() > 0 ) {
               wp_update_post( array(
                   "ID" => $shortcode->get_post_id(),
                   "post_status" => "pending"
               ) );
   
               if( !is_user_logged_in() && get_post_meta( $post_id, "_adverts_account", true) == 1 ) {
                   adverts_create_user_from_post_id( $post_id, true );
               }
               do_action( "wpadverts_advert_saved", $post_id );
   
               wp_redirect( "https://gido.website" );
               exit;
           }
   
           return $tpl;
       } );
       ```
   
    -  This reply was modified 4 years, 8 months ago by [Greg Winiarski](https://wordpress.org/support/users/gwin/).

Viewing 1 replies (of 1 total)

The topic ‘Emails Problem’ is closed to new replies.

 * ![](https://ps.w.org/wpadverts/assets/icon-256x256.png?rev=2423472)
 * [WPAdverts - Classifieds Plugin](https://wordpress.org/plugins/wpadverts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wpadverts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wpadverts/)
 * [Active Topics](https://wordpress.org/support/plugin/wpadverts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wpadverts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wpadverts/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * Last activity: [4 years, 8 months ago](https://wordpress.org/support/topic/emails-problem-2/#post-14961413)
 * Status: not resolved