How to expose a custom meta (“review_id”) in %review.review_id% token in Review Approved Email

Hello HivePress
I generate a short alphanumeric Review ID when a customer submits a review and save it in comment-meta. The ID appears correctly in WP-Admin → Comments (custom “Review ID” column), but I can’t get it into the “Review Approved” email:

  • %review_id% & %review.review_id% both render literally in the message.
  • In the email editor the token list at the bottom never shows a review_id token.

What Ive Tried

/* 1 ▸ register meta as a Review model field */
add_filter( 'hivepress/v1/models/review', function ( $model ) {
	$model['fields']['review_id'] = [
		'type'      => 'string',
		'_external' => true   // hoping this exposes it to tokens
	];
	return $model;
} );

/* 2 ▸ generate & store ID on review creation */
add_action( 'hivepress/v1/models/review/create', function ( $review_id, $review ) {

	if ( ! metadata_exists( 'comment', $review_id, 'review_id' ) ) {
		$code = strtoupper( wp_generate_password( 4, false, false ) ); // e.g. WTQZ
		update_comment_meta( $review_id, 'review_id', $code );
	}
}, 10, 2 );

Issue

Even after registering the field, %review.review_id% still isn’t listed as an available token in Emails → Review Approved, and the literal placeholder shows up in the sent email.

Could you please confirm the correct way to:

  1. Register a comment-meta field so it’s available via the %review…% token path.
  2. Use that token in the email template without extra filters.

Hi,

Thanks for the details. Please try changing this line:

'type' => 'string',

to:

'type' => 'text',

This should make the field available, it’s ok if it’s not listed in the Details section - this text is set in the code so custom added tokens will not appear in this UI list. If the field is available and has value, then %review.review_id% token should start working.

Hope this helps