Title: Double moderation
Last modified: January 26, 2022

---

# Double moderation

 *  [vasian4515](https://wordpress.org/support/users/vasian4515/)
 * (@vasian4515)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/double-moderation/)
 * Hi Greg, i set to moderation status all new ads. I also set published ads in 
   moderation if they were changed by users were editing, by this code:
 *     ```
       add_filter( "adverts_sh_manage_list_statuses", function( $s ) {
           $s[] = "pending";
           return $s;
       } );
       add_action( "adverts_post_save", function( $form, $post_id ) {
           if( adverts_request( "_adverts_action" ) == "update" ) {
               wp_update_post( array( 
                   "ID" => $post_id,
                   "post_status" => "pending"
               ) );
           }
       }, 10, 2 );
       ```
   
 * When new ads is being in moderation, i recive Email. But when old are waiting
   moderation (about this code) i dont recive email. Can you help me please

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

 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/double-moderation/#post-15291862)
 * Hi,
    1. you do not need a code to enable moderation when user updates an Ad from
   the page with [adverts_manage] shortcode, there is an option for that in the 
   wp-admin / Classifieds / Options / Core panel.
 * 2. to send an email when the Ad changes status to pending you can add the code
   below in your theme functions.php file
 *     ```
       function on_advert_pending( $ID, $post ) {
           $to = get_option( "admin_email" );
           $subject = "Ad Pending Moderation";
           $url = admin_url( sprintf( 'post.php?post=%d&action=edit', $ID ) );
           $m = sprintf( "Ad %s is waiting for approval.", $url );
           wp_mail( $to, $subject, $m );
       }
       add_action(  'pending_advert',  'on_advert_pending', 10, 2 );
       ```
   
 * Note that this will trigger a message for both publishings an Ad (if it goes 
   to preview) and editing it, so if you have the moderation email enabled in the
   Emails Module then you can disable it to avoid having the moderation email sent
   twice.
 *  Thread Starter [vasian4515](https://wordpress.org/support/users/vasian4515/)
 * (@vasian4515)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/double-moderation/#post-15292184)
 * Thank you very much, it works
 *  Thread Starter [vasian4515](https://wordpress.org/support/users/vasian4515/)
 * (@vasian4515)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/double-moderation/#post-15293317)
 * Last question, in ads core settings i set redirect expired ads URL to [https://kurortov.com/poisk-zhilja](https://kurortov.com/poisk-zhilja)
   and it works well for expired ads. But when old ad that waiting moderetion (was
   edited by user), his URL at moment of pending moderation shows 404 page “Not 
   found” Tell me please, how to redirect it to [https://kurortov.com/poisk-zhilja](https://kurortov.com/poisk-zhilja)
   I know there are plugins of redirection, but i am affraid that they will broke
   something.
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/double-moderation/#post-15296883)
 * Hi,
    i had a similar question a while ago, unfortunately, it is not really possible
   right now.
 * This is because the pending ads are using the default WP “pending” status, so
   in order to allow all users to view pending ads I would need to make all posts(
   including the default posts and pages) with the status Pending visible to all
   users which is a potential security risk.
 * Most likely in the next release, I will just disable the Preview button in the[
   adverts_manage] for the pending ads so the users will not see a link pointing
   to a 404 page, and in the future, some other way to preview the ads will be implemented.
 *  Thread Starter [vasian4515](https://wordpress.org/support/users/vasian4515/)
 * (@vasian4515)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/double-moderation/#post-15297006)
 * Hi,i mean URL of old ad that is pending moderation. This URL indexed in google
   from the first moment ad was published. And now this ad is pending moderation
   after changes again. And at this moment other users from google see by following
   this ad URL link – page 404 I just want them to see page of my site until this
   ad passes moderation. If I understood correctly, if i somehow set global redirect
   from page 404 to [https://kurortov.com/poisk-zhilja](https://kurortov.com/poisk-zhilja)
   so this wont help?
    -  This reply was modified 4 years, 4 months ago by [vasian4515](https://wordpress.org/support/users/vasian4515/).
    -  This reply was modified 4 years, 4 months ago by [vasian4515](https://wordpress.org/support/users/vasian4515/).
 *  Plugin Author [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * (@gwin)
 * [4 years, 4 months ago](https://wordpress.org/support/topic/double-moderation/#post-15301501)
 * Hi,
    ohh i see, i agree that would be good to show some other content while the
   page is in moderation, however in this case there is actually the same problem
   as with the new ads that are pending moderation since updating an Ad also changes
   the status to the default WP “pending”.
 * I will add this to our issue tracker, it should be resolved in one of next releases.

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

The topic ‘Double moderation’ 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/)

 * 6 replies
 * 2 participants
 * Last reply from: [Greg Winiarski](https://wordpress.org/support/users/gwin/)
 * Last activity: [4 years, 4 months ago](https://wordpress.org/support/topic/double-moderation/#post-15301501)
 * Status: not resolved