Why Editor reformats my code

I suggest you to use htmlspecialchars() before sending content andhtmlspecialchars_decode() before showing content on page, here is functions that you need to copy/paste to your functions.php : function wp_po9568($content) { return htmlspecialchars($content); } add_filter(‘content_save_pre’,’wp_po9568′); And: function wp_po5689($content) { return htmlspecialchars_decode($content); } add_filter( ‘the_content’,’wp_po5689′); WordPress by default comments out php tags.

Change the background of the TinyMCE editor with available WP arguments

So this is how I achieved what I was after – The filter ‘tiny_mce_before_init’ is used to update the settings of the editor, so you can add your own JS to the ‘setup’ key. add_filter(‘tiny_mce_before_init’, ‘initiate_tinyMCE_wordcount’); function initiate_tinyMCE_wordcount($initArray){ $initArray[‘setup’] = <<<JS [function(ed){ ed.onLoad.add(function(ed, e){ var tb_name = tinyMCE.activeEditor.id; // The ID of the active editor … Read more

TinyMCE: Move buttons from 2nd row to top row

Solved it. So, in order to move the default buttons from first row to second row, we will need to hook into the mce_buttons filter: function move_mce_buttons_to_top($buttons) { $buttons[] = ‘redo’; // buttons return $buttons; } add_filter(‘mce_buttons’, ‘move_mce_buttons_to_top’); Then, to add the Paragraph drop-down to top row, we will add them as custom styles. Firstly, … Read more

WordPress (TinyMCE) not removing script tags

Ok, it was my oversight – and s_ha_dum was almost spot on – I was kindly directed to this: http://codex.wordpress.org/Security_FAQ#Why_are_some_users_allowed_to_post_unfiltered_HTML.3F which explains the situation perfectly. In case this is of any use to anyone I have fixed it for the site I’m working on using the wp_insert_post_data filter, like this: add_filter( ‘wp_insert_post_data’ , ‘filter_post_data’ , … Read more

TinyMCE 4 & wp_editor multiple editor issue

Since 3.9 some parts of the settings for the original Editor are wrapped in a self::first_init condition. This includes the plugins filter for external tinymce plugins. So, in a subsequent call for an editor, the filter won’t run. Solution: One can pass a tinymce settings array to the settings of wp_editor(), that’s where I would … Read more

Allowing style tag in TinyMCE editor

There are some things to try in this stackoverflow thread. The one I’m trying: add_filter(‘tiny_mce_before_init’, ‘vsl2014_filter_tiny_mce_before_init’); function vsl2014_filter_tiny_mce_before_init( $options ) { if ( ! isset( $options[‘extended_valid_elements’] ) ) { $options[‘extended_valid_elements’] = ‘style’; } else { $options[‘extended_valid_elements’] .= ‘,style’; } if ( ! isset( $options[‘valid_children’] ) ) { $options[‘valid_children’] = ‘+body[style]’; } else { $options[‘valid_children’] .= … Read more

Customizing tinyMCE 4 Styles and Format dropdowns

You can control the font size and type in the format dropdown by adding an editor style. WPSE user helgatheviking explained how to add styles to the format dropdown in her post here. I’ve included the relevant code below with one minor adjustment which allows CSS attributes like color and line-height to be inherited by … Read more

Overriding TinyMCE buttons – Justify button shortcodes not working

Because you are using button references to version 3 of TinyMCE. Beginning in WordPress version 3.9; TinyMCE 4 is being used. Check this page, then click the “View Source” tab to see the new button names. Working from your array above: TinyMCE 3 TinyMCE 4 justifyleft => alignleft justifycenter => aligncenter justifyright => alignright As … Read more

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