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.

Example for use tinymce in wordpress 3.5.1?

Use wp_editor(). There are many configuration options; you have to read the source to get all of them. Example: $editor_settings = array ( ‘textarea_rows’ => 15, ‘media_buttons’ => FALSE, ‘teeny’ => TRUE, ‘tinymce’ => TRUE, ‘dfw’ => FALSE, ); $content = $get_option( ‘your_option_name’ ); wp_editor( $content, ‘your_editor_id’, $editor_settings );

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.