Join

Hold All Listing Reviews for Moderation and Notify Website Admin

Don't want to mess with code snippets? Request for this to be a feature of MyListing Pro.

Instructions

  1. Create a new PHP code snippet.
  2. Copy the contents of code snippet below.
  3. Paste the contents into your code snippet.
  4. Review any notes that I’ve provided.
  5. Save and enable the code snippet.
  6. Test.

Snippet

When a user posts a review for a Listing, the review will be held in the system, the website admin will be notified via email, and the review will be released when/if the website admin approves it.

add_filter( 'pre_comment_approved', function( $commentstatus, $commentdata ) {
    $commentstatus = 0;
    return $commentstatus;
}, 10, 2 );

add_filter( 'wp_update_comment_data', function( $data, $comment, $commentarr ) {

    if ( isset( $data['comment_approved'] ) ) {
        $data['comment_approved'] = 0;
    }
    return $data;
}, 99, 3 );