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 can a TinyMCE modal return formatted/visual text?

(Revised answer) You can use tinymce.DOM.encode() to convert all HTML tags to their entities, e.g. &lt; for < and &gt; for >: var html = tinymce.DOM.encode(e.data.code); Then to preserve trailing white-spaces: html = html.replace(/(^ +| +$)/gm, function(match, p1){ return p1.replace(/ /g, ‘&nbsp;’); }); And this to convert all line breaks to <br>: html = html.replace(/(?:\r\n|\r|\n)/g, … Read more

HTML formatting issues when switching between editor tabs

I was finally able to get this fixed after some more debugging. I had previously disabled TinyMCE emojis which is what was causing the issue. After removing this code from functions.php the editor started working as it normally does. function disable_emojis() { add_filter( ‘tiny_mce_plugins’, ‘disable_emojis_tinymce’ ); } add_action( ‘init’, ‘disable_emojis’ );

WordPress no longer holding post formatting

TinyMCE – at least, as-configured for WordPress – isn’t explicitly designed for copying/pasting of text richly formatted in other word processors. That said: how are you pasting? Are you simply copy/pasting (i.e. via CTRL-C, CTRL-V; or else via right-clicking and using contextual menu commands), or are you using the “Paste From Word” button on the … Read more

How to force insertion in editor

Facilitating users to write content in an external editor, and then copy/paste it into the WordPress editor, is a fundamentally bad approach, and is fraught with issues. The WordPress editor is intended to be used to write content. You should train your users to use the post editor to write content, as opposed to using … Read more

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