Target wp_editor buttons to add a tooltip

The “bold” icon on the visual editor is represented by a <span> with the class of mce_bold. You can target it using jQuery pretty easily and add a tooltip: jQuery(‘.mce_bold’).attr(‘title’, ‘Please use an H2 tag instead.’); If you want to target it inside the HTML editor as well, use this code instead: jQuery(‘.mce_bold, #qt_content_strong’).attr(‘title’, ‘Please … Read more

Change the name of the wp_editor tab “html/text”

Filter gettext_with_context and change the name here: <?php # -*- coding: utf-8 -*- /* Plugin Name: Rename ‘Text’ editor to ‘HTML’ */ add_filter( ‘gettext_with_context’, ‘change_editor_name_to_html’, 10, 4 ); function change_editor_name_to_html( $translated, $text, $context, $domain ) { if ( ‘default’ !== $domain ) return $translated; if ( ‘Text’ !== $text ) return $translated; if ( ‘Name … Read more

Save wp_editor() content as option

If you just want to get rid of the \ characters in the string that’s returned, you can use PHP’s stripslashes(): $content = stripslashes( $content ); I’d recommend doing this on output rather than on input; WordPress adds the slashes as it sanitizes your data on insert, per update_option()‘s Codex page, The $option (option name) … Read more

Quotes being escaped inside wp_editor when saved with wp_kses_post

WordPress always escapes quotes encountered in the super globals variables. It is done in https://developer.wordpress.org/reference/functions/wp_magic_quotes/ You will most likely want to strip it with stripslashes before saving it into the DB. something like update_option( ‘tld_wcdpue_settings_email_content’, wp_kses_post( stripslashes($_POST[‘tld_wcdpue_settings_wpeditor’] ) ));

How to pass the wp_editor content using jquery

You have to access the tinymce object like this: tinymce.get(“your_textarea_ID_goes_here”).setContent(“Place your content here”); As a practical example – if you declared your wp_editor like this: wp_editor( “”, “special_content”, array() ); Then the tinymce call would look like this: tinymce.get(“special_content”).setContent(“Place your content here”); Bonus details: if you want to grab the content from the editor use … Read more

WP_Editor – Setting render location on page

As kaiser has stated, you are attempting to return the the markup for an instance of the WP Editor, but you’re using wp_editor() – a function that echos its output. From the source it is absolutely clearly stated that this method renders the editor. You need to call it exactly where you want it.

Changing the default WP editor font and size

You’ll need to add support for your theme (if it does not already have it) for editor styles. See this for more information: http://codex.wordpress.org/Function_Reference/add_editor_style Then you’ll just need to create a stylesheet. There are some themes out there that already support editor styles, which might be a good place to start in order to know … Read more