wp_editor doesn’t save styling

You are stripping all HTML tags before saving principle_duties. sanitize_text_field() This function strips all HTML tags, so the value being stored has no HTML. That’s why it’s coming out as totally plain text. To sanitize wp_editor I would use wp_kses(). See here on how to use it: https://codex.wordpress.org/Function_Reference/wp_kses For the allowed HTML tags, you can … Read more

Stop editor from adding “amp;” after every “&”

One solution is to hook into wp_insert_post_data and do some regex magic to replace all instances of & with &: // when saving posts, replace & with & function cc_wpse_264548_unamp( $data ) { $data[‘post_content’] = preg_replace( “/&/”, // find ‘&’ “&”, // replace with ‘&’ $data[‘post_content’] // target the ‘post_content’ ); return $data; } add_filter( … Read more

How to apply a custom skin to WP_Editor / TinyMCE?

Apparently, the default WordPress style files overwrite a custom TinyMCE skin. So what you need to do is deregister WordPress’s TinyMCE skin. Since I needed the custom skin to only apply on the front-end on my website, I wrapped it inside an !is_admin() conditional. function remove_editor_buttons_style() { // If not on wp-admin if ( !is_admin() … Read more

how to save wp_editor html content in options table

echo ‘<form action=”” class=”booked-settings-form” method=”post”>’; $default_content=”<p>Mail formate</p>”; $editor_id = ‘customerCleanerMail’; $option_name=”customerCleanerMail”; $default_content=html_entity_decode($default_content); $default_content=stripslashes($default_content); wp_editor( $default_content, $editor_id,array(‘textarea_name’ => $option_name,’media_buttons’ => false,’editor_height’ => 350,’teeny’ => true) ); submit_button(‘Save’, ‘primary’); echo ‘</form>’; if(isset($_POST[‘customerCleanerMail’]) ){ $var2=htmlentities(wpautop($_POST[‘customerCleanerMail’])); $fff=update_option(‘customerCleanerMail’, $var2); } In form section i used wp_editor with his options, wp_editor work like html editor but when you store these data … Read more

Migrating from metaboxes to wp_editor()

It works just the same like a regular textarea with the exception of the data being escaped so when you call for the saved data just make sure to decode the html entities using html_entity_decode here is a very simple demo class, take a look at how the field is created. if (!class_exists(‘wp_editor_meta_box’)){ class wp_editor_meta_box{ … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)