To give reviews a star rating and a "Recommended" switch, create a fieldset with the fields and give it a Comment Type Location that selects Reviews. Ordinary comments are listed as Comments. The fields then belong to every comment of that type.
Narrow the Location with conditions when only some comments should have them: Post type for reviews of Books only, Reply so a reply to a review doesn't get its own rating, Comment status, Comment author (a signed-in user or a guest) and Comment author role. Specific post and Taxonomy term test the post the comment is on. See Locations.
The fields appear in a Fields box on WordPress's Edit Comment screen, and save with the comment's Update button. Quick Edit in the comment list doesn't show them.
A Comment Type Location without a Viewer role or Viewer capability condition is filled in by moderators, the users who can moderate comments. WordPress also lets a post's author edit the comments on their post; without this rule, the author of a Book could change the ratings in its reviews. Add a Viewer condition to open the fieldset to other people on purpose.
VX doesn't add fields to the comment form on your site. Your theme collects them and stores them through VX, so a visitor can leave a rating with their review. See Comment forms.
In the block editor, put dynamic tags inside the Comments block's Comment Template, where each comment is rendered. @comment(rating) shows the rating of the comment being rendered, and the canonical properties work the same way:
text
@comment(author_name) rated it @comment(rating) out of 5
The editor previews real values for the comments the Comments block shows there. WordPress's editor shows only ordinary comments in it, so comments of your own types appear on the published page but not in the editor. Outside a Comment Template, @comment(…) has no comment to read and shows nothing. See Adding dynamic tags.
PHP templates read a comment's fields the way they read a post's, and apps read them over the REST API from each comment's vx field. See Reading values in PHP and Exposing content.
Location object:comment_type; targets are comment type keys (comment for ordinary comments, including ones stored with an empty type). Pool comment_types: comment, then registered types, then vxframework/comment_types/external.
Who fills in: with no viewer condition in effect, filling in (editing) needs moderate_comments; saving also needs edit_comment. Value reads ignore both.
Storage: comment meta, keyed by field key. Field keys must be unique per comment type. Relation fields store in the relations table with parent_kind/child_kindcomment.
Edit Comment screen: meta box vx-fieldsets-editor (add_meta_boxes_comment), saved on edit_comment with nonce action vxframework_fieldsets_comment; a save with field errors returns to the comment and shows them.
Key renames migrate comment meta of the location's types (Meta Watch storage comment_meta).
Abilities:vx-framework/create-comment, vx-framework/update-comment, vx-framework/delete-comment (the comment itself), vx-framework/get-comment-values, vx-framework/set-comment-values (id or ids, patch semantics, if_match), vx-framework/query-comments (type, status, post, post_type, parent, author, search, ids, field_filters with one type), vx-framework/count-comments (group_by: type | status); vx-framework/get-object-fields with object_type: comment_type, key: <type>.
Using comment fields
To give reviews a star rating and a "Recommended" switch, create a fieldset with the fields and give it a Comment Type Location that selects Reviews. Ordinary comments are listed as Comments. The fields then belong to every comment of that type.
Narrow the Location with conditions when only some comments should have them: Post type for reviews of Books only, Reply so a reply to a review doesn't get its own rating, Comment status, Comment author (a signed-in user or a guest) and Comment author role. Specific post and Taxonomy term test the post the comment is on. See Locations.
Filling them in
The fields appear in a Fields box on WordPress's Edit Comment screen, and save with the comment's Update button. Quick Edit in the comment list doesn't show them.
A Comment Type Location without a Viewer role or Viewer capability condition is filled in by moderators, the users who can moderate comments. WordPress also lets a post's author edit the comments on their post; without this rule, the author of a Book could change the ratings in its reviews. Add a Viewer condition to open the fieldset to other people on purpose.
VX doesn't add fields to the comment form on your site. Your theme collects them and stores them through VX, so a visitor can leave a rating with their review. See Comment forms.
Showing them on your site
In the block editor, put dynamic tags inside the Comments block's Comment Template, where each comment is rendered.
@comment(rating)shows the rating of the comment being rendered, and the canonical properties work the same way:The editor previews real values for the comments the Comments block shows there. WordPress's editor shows only ordinary comments in it, so comments of your own types appear on the published page but not in the editor. Outside a Comment Template,
@comment(…)has no comment to read and shows nothing. See Adding dynamic tags.PHP templates read a comment's fields the way they read a post's, and apps read them over the REST API from each comment's
vxfield. See Reading values in PHP and Exposing content.Related
Technical details for LLMs
comment_type;targetsare comment type keys (commentfor ordinary comments, including ones stored with an empty type). Poolcomment_types:comment, then registered types, thenvxframework/comment_types/external.comment_post_type,comment_status(approved|unapproved|spam|trash),comment_level(top_level|reply),comment_author(registered|guest) →is_any_of/is_none_of(value inputchoices);comment_author_role(role_select);specific_postandtaxonomy_termtest the comment's post;viewer_role,viewer_capability.editing) needsmoderate_comments; saving also needsedit_comment. Value reads ignore both.parent_kind/child_kindcomment.vx-fieldsets-editor(add_meta_boxes_comment), saved onedit_commentwith nonce actionvxframework_fieldsets_comment; a save with field errors returns to the comment and shows them.comment_meta).vx-framework/create-comment,vx-framework/update-comment,vx-framework/delete-comment(the comment itself),vx-framework/get-comment-values,vx-framework/set-comment-values(idorids, patch semantics,if_match),vx-framework/query-comments(type,status,post,post_type,parent,author,search,ids,field_filterswith onetype),vx-framework/count-comments(group_by:type|status);vx-framework/get-object-fieldswithobject_type: comment_type,key: <type>.note) never take fields.