Updating post content on the front end
You should use the wp_update_post function.
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
You should use the wp_update_post function.
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
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
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’] ) ));
What you are writing in your js file is not “real” Javascript Code, but an extension named “JSX” which can help you write the elements like XML-Code. Before you can “use” the block js file, you first have to “compile” it into “real” Javascript code. You can use npx and webpack for this. The Tutorial … Read more
How do I prevent the wp_editor from loading outside container?
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
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.
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