I am creating custom wordpress plugin, with html field(text datatype). I successfully store the data with this value <div id="test">Test</div> from

Test

. But I am having problem with update, It does not update the html in database if it contains html tags, It only updates when I have string values like “1234”.

For Insert I used

$wpdb->insert(
            $table_name, //table
            array('html' => esc_html($html), 'css' => $css), //data
            array('%s', '%s', '%s') //data format           
            );

For Update

$sql = "update " . $table_name ." set html = " .esc_html($html);
$wpdb->query( $sql );

Read more here: WordPress custom plugin storing raw html


Solution:

If you know the solution of this issue, please leave us a reply in Comment section, to update the question.


Wordpress related questions and answers: