I have a PHP Code that loads some HTML from the database and echo
to my cpage, Problem is when I echo
code the HTML becomes like this:
<div itemscope="\"\"" itemtype="\"https://schema.org/FAQPage\"">
<div itemscope="\"\"" itemprop="\"mainEntity\"" itemtype="\"https://schema.org/Question\"" >
<h3 itemprop="\"name\"" >test quistion?</h3>
<div itemscope="\"\"" itemprop="\"acceptedAnswer\"" itemtype="\"https://schema.org/Answer\"">
<p itemprop="\"text\"" >Test answer</p>
</div>
</div>
My Code to echo
HTML:
<?php
$cat_data = get_option("category_$cat_id");
if (isset($cat_data['faq'])){
echo $cat_data['faq'];
} } ?>
CodePudding user response:
It works with this:
echo stripslashes($cat_data['faq']);
thanks to @numediaweb How save JavaScript and HTML in option without it being auto-escaped?
CodePudding user response:
Try this:
<?php
$cat_data = get_option("category_$cat_id");
if (isset($cat_data['faq'])){
echo html_entity_decode($cat_data['faq'], ENT_QUOTES, 'UTF-8');
} } ?>