Skip to content

Commit

Permalink
unescaped unicode, include <br>
Browse files Browse the repository at this point in the history
  • Loading branch information
mxkae committed Oct 4, 2023
1 parent b32981b commit 8505ebd
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/block/accordion/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ public function get_faq_answer( $block, $answer ) {
if ( $count_inner_blocks == 0 ) {
// check if it contains a text
if ( trim( wp_strip_all_tags( $block[ 'innerHTML' ], true ) ) != '' ) {
// return the text without tags
return $answer . trim( wp_strip_all_tags( $block[ 'innerHTML'], true ) );
// return the text after stripping all tags except <br>
return $answer . trim( strip_tags( $block[ 'innerHTML'], ["<br>"] ) );
}
return $answer;
}
Expand Down Expand Up @@ -129,10 +129,10 @@ public function render_block_accordion_faq_schema( $block_content, $block ) {

$this->faq_entities[] = '{
"@type": "Question",
"name": ' . json_encode( $question ) . ',
"name": ' . json_encode( $question, JSON_UNESCAPED_UNICODE ) . ',
"acceptedAnswer": {
"@type": "Answer",
"text": ' . json_encode( $answer ) .'
"text": ' . json_encode( $answer, JSON_UNESCAPED_UNICODE ) .'
}
}';
}
Expand Down

0 comments on commit 8505ebd

Please sign in to comment.