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:
- Register a comment-meta field so it’s available via the %review…% token path.
- Use that token in the email template without extra filters.