wp_get_unapproved_comment_author_email example

$comment_args = array(
        'orderby'       => 'comment_date_gmt',
        'order'         => 'ASC',
        'status'        => 'approve',
        'no_found_rows' => false,
    );

    if ( is_user_logged_in() ) {
        $comment_args['include_unapproved'] = array( get_current_user_id() );
    } else {
        $unapproved_email = wp_get_unapproved_comment_author_email();

        if ( $unapproved_email ) {
            $comment_args['include_unapproved'] = array( $unapproved_email );
        }
    }

    if ( ! empty( $block->context['postId'] ) ) {
        $comment_args['post_id'] = (int) $block->context['postId'];
    }

    if ( get_option( 'thread_comments' ) ) {
        


    if ( get_option( 'thread_comments' ) ) {
        $comment_args['hierarchical'] = 'threaded';
    } else {
        $comment_args['hierarchical'] = false;
    }

    if ( is_user_logged_in() ) {
        $comment_args['include_unapproved'] = array( get_current_user_id() );
    } else {
        $unapproved_email = wp_get_unapproved_comment_author_email();

        if ( $unapproved_email ) {
            $comment_args['include_unapproved'] = array( $unapproved_email );
        }
    }

    $per_page = 0;
    if ( get_option( 'page_comments' ) ) {
        $per_page = (int) get_query_var( 'comments_per_page' );
        if ( 0 === $per_page ) {
            $per_page = (int) get_option( 'comments_per_page' );
        }
'date_query' => array(
                array(
                    'column' => "$wpdb->comments.comment_date_gmt",
                    'before' => $comment->comment_date_gmt,
                ),
            ),
        );

        if ( is_user_logged_in() ) {
            $comment_args['include_unapproved'] = array( get_current_user_id() );
        } else {
            $unapproved_email = wp_get_unapproved_comment_author_email();

            if ( $unapproved_email ) {
                $comment_args['include_unapproved'] = array( $unapproved_email );
            }
        }

        /** * Filters the arguments used to query comments in get_page_of_comment(). * * @since 5.5.0 * * @see WP_Comment_Query::__construct() * * @param array $comment_args { * Array of WP_Comment_Query arguments. * * @type string $type Limit paginated comments to those matching a given type. * Accepts 'comment', 'trackback', 'pingback', 'pings' * (trackbacks and pingbacks), or 'all'. Default 'all'. * @type int $post_id ID of the post. * @type string $fields Comment fields to return. * @type bool $count Whether to return a comment count (true) or array * of comment objects (false). * @type string $status Comment status. * @type int $parent Parent ID of comment to retrieve children of. * @type array $date_query Date query clauses to limit comments by. See WP_Date_Query. * @type array $include_unapproved Array of IDs or email addresses whose unapproved comments * will be included in paginated comments. * } */
Home | Imprint | This part of the site doesn't use cookies.