I’m trying to create a plugin with a visual editor and add media button that can POST and insert into the database all the HTML data. Here is my code:
<?php
if($_POST){
print_r($_POST);
global $wpdb;
$table_name = $wpdb->prefix . "eventi_ecm";
$name = $_POST['name'];
$text = $_POST['content'];
//$rows_affected = $wpdb->insert( $table_name, array( 'time' => current_time('mysql'), 'name' => $name, 'text' => $text ) );
}
$settings = array('textarea_name' => 'content','media_buttons' => true,'tinymce' => false);
?>
<div>
<h2>New Event</h2>
<form method="post" action="http://test.ble-group.com/wordpress/wp-admin/admin.php?page=eventi_new_page">
<div id="poststuff">
<input type="text" name="name"/>
<?php wp_editor( '', 'content', $settings ); ?>
</div>
</div>
<input type="hidden" name="action" value="update" />
<p><input type="submit"/></p>
</form>
</div>
But when I try to insert images, the HTML code about the image it’s stripped. 🙁
I found this article which might help you.
In short, article suggests to use this code:
and this code to display the output:
thanks @user850010, but didn’t worked, I solved this way: