Skip to content

Commit

Permalink
update: moved allowed tags array inside condition
Browse files Browse the repository at this point in the history
  • Loading branch information
up1512001 committed Jun 13, 2024
1 parent a9dc6e4 commit 0bc31cd
Showing 1 changed file with 56 additions and 56 deletions.
112 changes: 56 additions & 56 deletions src/wp-includes/formatting.php
Original file line number Diff line number Diff line change
Expand Up @@ -4049,65 +4049,65 @@ function wp_trim_words( $text, $num_words = 55, $more = null, $allow_tags = fals
$more = __( '…' );
}

$allowed_tags = array(
'a' => array(
'class' => array(),
'style' => array(),
'href' => array(),
'id' => array(),
),
'strong' => array(),
'b' => array(),
'em' => array(),
'img' => array(
'class' => array(),
'style' => array(),
'src' => array(),
'alt' => array(),
'width' => array(),
'height' => array(),
),
'mark' => array(
'class' => array(),
'style' => array(),
),
'code' => array(
'class' => array(),
'style' => array(),
),
'kbd' => array(
'class' => array(),
'style' => array(),
),
'bdo' => array(
'class' => array(),
'style' => array(),
'dir' => array(),
'lang' => array(),

),
'span' => array(
'class' => array(),
'style' => array(),
),
'sup' => array(
'class' => array(),
'style' => array(),
),
'sub' => array(
'class' => array(),
'style' => array(),
),
's' => array(
'class' => array(),
'style' => array(),
),
);


$original_text = $text;
if ( $allow_tags ) {
$allowed_tags = array(
'a' => array(
'class' => array(),
'style' => array(),
'href' => array(),
'id' => array(),
),
'strong' => array(),
'b' => array(),
'em' => array(),
'img' => array(
'class' => array(),
'style' => array(),
'src' => array(),
'alt' => array(),
'width' => array(),
'height' => array(),
),
'mark' => array(
'class' => array(),
'style' => array(),
),
'code' => array(
'class' => array(),
'style' => array(),
),
'kbd' => array(
'class' => array(),
'style' => array(),
),
'bdo' => array(
'class' => array(),
'style' => array(),
'dir' => array(),
'lang' => array(),

),
'span' => array(
'class' => array(),
'style' => array(),
),
'sup' => array(
'class' => array(),
'style' => array(),
),
'sub' => array(
'class' => array(),
'style' => array(),
),
's' => array(
'class' => array(),
'style' => array(),
),
);
$text = wp_kses( $text, $allowed_tags );
} else {
} else {
$text = wp_strip_all_tags( $text );
}
$num_words = (int) $num_words;
Expand Down

0 comments on commit 0bc31cd

Please sign in to comment.