$keys, 'orderby' => 'comment__in', 'number' => count( $keys ), 'no_found_rows' => true, 'count' => false, ]; /** * Execute the query. Call get_comments() to add them to the cache. */ $query = new \WP_Comment_Query( $args ); $query->get_comments(); $loaded = []; foreach ( $keys as $key ) { $loaded[ $key ] = \WP_Comment::get_instance( $key ); } return $loaded; } }