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.
Related Posts:
- Want to have the Post editor remembering the last editing position
- How to change background color in the Notepad++ text editor?
- Is it OK to remove theme credits from footer? [duplicate]
- How to see files in directories in “Edit Themes” screen
- Error message “The page you are looking for is temporarily unavailable.” after editing a file [closed]
- Theme Editor Not Showing
- Edited Child Theme’s “header.php” but it doesn’t appear to change the file
- Theme option not saved if in wp_editor() and html decoded
- Where did my Theme Editor go?
- WP Snippet to Hide Theme Editor In Dashboard Only Works On LocalHost Site
- Line break no working on theme
- permissions on themes directory
- How to prevent tinyMCE editor to be loaded completely in Text Editor?
- What are all the available parameters for query_posts?
- Does WordPress work without a theme?
- What theme is good for posting code? [closed]
- Difference between stylesheet_directory and template_directory
- WordPress generating 404 on .mp4 file in theme folder
- Why are my widgets not saving when being added to a sidebar?
- Building useful features into your theme
- How to remove “Proudly powered by WordPress” in Twenty Sixteen (2016) theme?
- Editing theme files and access to the Code pages only to super-admin?
- Edit theme wp_head
- Current theme broken – after server and domain migration
- Theme Advanced Styles in Visual Editor and Paragraphs
- Enqueue different stylesheets using IE conditionals
- WordPress tinymce prints empty P tag and break html format
- Categories for Pages Not Saving in Admin with Custom Categories Metabox?
- Switch Theme Through Options Panel
- Override parent theme translation on child theme
- Forbidden 403 error, permission to access, unable to read htaccess
- Weird post pagination url redirect
- Add table controls with wp_editor minimal editor configuration (‘teeny’)
- How get Themes list via REST api?
- Activate a new WordPress Theme Only for Admins
- WordPress Fatal error: Call to undefined get_header() in index.php on line 15 [closed]
- How do I copy my Parent Templates to my Child Templates?
- How can I show more than 15 themes at a time in the admin menu?
- What is the WordPress Pinecone sitting on top of? [closed]
- Pros and cons of using Backbone for WordPress theming [closed]
- Can I create multiple instances of the BuddyPress Activity Stream with separate themes? [closed]
- Disable HTML (Text) Tab in Post Editor
- Can I rename a theme’s folder and still receive updates?
- Child theme not visible
- How to load parent theme style.css?
- How to setup a new WordPress theme without deactivating the current theme?
- WordPress is not able to change themes
- How do I set the featured image size on the single post?
- Where all are child themes recorded when they are created in WordPress
- I have some doubts regarding how to implement child theme
- Inconsistent translation on a WP site
- Incompatible Archive. PCLZIP_ERR_BAD_FORMAT (-10)
- how to remove category nav from Bueno (WordPress Theme) header [closed]
- How can I have different theme with same booking table? [closed]
- Updating my free theme delete all my changes [closed]
- Add buttons to the new TinyMCE WP Editor. Javascript API
- Web site Header tag links some resources with HTTPS
- Do not show one specific widget on one specific page
- customize color in WP child theme doesn’t saved
- How to work on a new Theme for a site while still keeping the old Theme live
- Loading Bootstrap with wp_enqueue_style and wp_enqueue_script
- WordPress use of @ in core files
- Unable to upload/install any WordPress themes
- Change the name of the root name of an already built WordPress theme
- How to switch theme if the current user is admin?
- Cannot apply custom css to IE in the theme
- Why is the media upload button not in the main toolbar & can it be placed there instead?
- Understanding the theme details in style.css
- Getting a ‘slide down’ js panel implemented within WP
- Need a theme that let the posted content stretched maximum width [closed]
- Copying post thumbnail to custom field
- Trying to fix a website that was built with WordPress and then taken off of it
- Why does wordpress add Theme not list a specific theme anymore?
- WordPress theme layout problem
- current_user_can(‘manage_options’) causes white screen of death?
- header.php-tweak: How to do that getting Meta-Slider into the header-center?
- Will I lose the pages I’ve created within a default WordPress theme when adding a new theme?
- How to get the theme directory URI?
- Is there a way to see how a theme will look before buying it?
- Twenty Ten Theme: Replace the Logo by a picture without moving the code
- In a specific blog, the K2 theme does not have a Text Widget
- How to fix Scrape key check failed on WordPress VPS?
- Simple filter to change label name of Email Adress to something else
- Show only the beginning of post
- Edit a template while still keeping a Landing Page on the main address
- How can I Update my Theme
- Use random theme
- Change whole theme depending on resolution
- post_prev & post_next within same category
- Costum Theme template directoy url problem
- Replacing current theme folder by previous version of the same folder produces “undefined function get_header()” error
- Theme comment callback results nothing
- How to find out which template the HTML content comes from?
- What is the general cut-off date for reviewed themes in the WordPress.org repository?
- Sub-Theme (based on Taxonomies)
- Include root files into header files
- Commenting in CSS (//) equals “none”? [closed]
- Absolute and relative paths
- Help!!! Old theme doesn’t load scripts and conflitcs with plugins
- Fatal error Class-wp-hook, again, but not sure what’s triggering it