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

“switchEditors is not defined” with wp_editor() in jQuery UI tabs

I have tackled this by putting TinyMCE on the first tab, and making it a static tab, all others are still ajax, would still like it to be ajax, if anyone has any solutions. <div id=”tabs”> <ul id=”wpsca_ul”> <li><a href=”#wpsca_addedit” title=”add page”><?php echo __(‘Add Page’,’wpsca_lang’);?></a></li> <li><a href=”https://wordpress.stackexchange.com/questions/106799/<?php echo get_option(“siteurl’ ).’/?wpsca=wpscalist’;?>” title=”manage addedit”><?php echo __(‘Manage Pages’,’wpsca_lang’);?></a></li> … Read more

Send data to Editor before saving the post

Assuming you refer to the WP main editor, you can get the TinyMCE instance with var mainEditor = tinyMCE.getInstanceById(‘content’); then clear the current content with: mainEditor.setContent(”); and add your new content mainEditor.setContent(‘we are the borg lower your shields and surrender your ships’); If the new content doesn’t get saved, call tinyMCE.triggerSave(); additionally.

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

How to add class to an html output element in tinyMCE paragraph drop down menu

In my opinion, using the Styles dropdown is useful to show that the particular style you are adding is special and not the theme’s standard element styling for p, h1, h2, etc. The examples in the Codex to be pretty good at outlining this: http://codex.wordpress.org/TinyMCE_Custom_Styles // Callback function to filter the MCE settings function my_mce_before_init_insert_formats( … 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

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