How can properly escaped content with html tag

themeforest

#1

For ex.

<?php
$data = '<div class="test"><label>Title</label><a href="#">Link</a><script type="text/javascript"> var i = "test";</script></div>';
echo $data;
?>

Envato Theme Check produce Warning
WARNING: Found echo $ in the file filename.php. Possible data validation issues found. All dynamic data must be correctly escaped for the context where it is rendered.

How can i solve this warning proper way.


#2

echo wp_kses_post( $data );