Only show reviewRating when rating is set.
This commit is contained in:
parent
eca9828d66
commit
0de73ee4f9
|
@ -248,14 +248,14 @@ class WC_Structured_Data {
|
||||||
$markup['@id'] = get_comment_link( $comment->comment_ID );
|
$markup['@id'] = get_comment_link( $comment->comment_ID );
|
||||||
$markup['datePublished'] = get_comment_date( 'c', $comment->comment_ID );
|
$markup['datePublished'] = get_comment_date( 'c', $comment->comment_ID );
|
||||||
$markup['description'] = get_comment_text( $comment->comment_ID );
|
$markup['description'] = get_comment_text( $comment->comment_ID );
|
||||||
$markup['itemReviewed'] = array(
|
|
||||||
'@type' => 'Product',
|
if ( $rating = get_comment_meta( $comment->comment_ID, 'rating', true ) ) {
|
||||||
'name' => get_the_title( $comment->post_ID ),
|
$markup['reviewRating'] = array(
|
||||||
);
|
'@type' => 'rating',
|
||||||
$markup['reviewRating'] = array(
|
'ratingValue' => $rating,
|
||||||
'@type' => 'rating',
|
);
|
||||||
'ratingValue' => get_comment_meta( $comment->comment_ID, 'rating', true ),
|
}
|
||||||
);
|
|
||||||
$markup['author'] = array(
|
$markup['author'] = array(
|
||||||
'@type' => 'Person',
|
'@type' => 'Person',
|
||||||
'name' => get_comment_author( $comment->comment_ID ),
|
'name' => get_comment_author( $comment->comment_ID ),
|
||||||
|
|
Loading…
Reference in New Issue