Skip to main content
18 votes
Accepted

How do you add custom color swatches to all WYSIWYG editors?

Click on the Custom... text and the color picker will pop up. Pick the color of your choice and press OK. Chosen color will appear as a custom swatch for later use. Note! The solution above is not a ...
Max Yudin's user avatar
  • 6,318
11 votes
Accepted

How to set the default embed image size

If you add this to functions.php, this will update the options as set. function custom_image_size() { // Set default values for the upload media box update_option('image_default_align', '...
Howard E's user avatar
  • 743
8 votes

Replace Taxomony Description Field with Visual/WYSIWYG Editor

For those still looking for a solution to this problem, it's worth mentioning that the Yoast SEO plugin adds a WYSIWYG editor for descriptions automatically on the taxonomy term edit screen. If you'...
jg314's user avatar
  • 511
7 votes

How do you add custom color swatches to all WYSIWYG editors?

In addition to Max's answer, if you are looking to add to the existing pallet, here is the default colour pallet: $custom_colours = '[ "000000", "Black", "993300", "Burnt orange", "...
JDandChips's user avatar
5 votes

How to Add WYSIWYG Editor (tinyMCE) to plugin options page compatible with Wordpress 3.0 and up?

<?php function my_address_function(){ if(isset($_POST['special_content'])){ update_option('special_content', $_POST['special_content']); } ?> <div class='wrap'> <h2>...
Anuj Singh Rajput's user avatar
5 votes

Snippet: Use classes instead of inline styles for text alignment

Note This answer was originally included in @bitstarr's question above and was included as a separate answer here to comply with WPSE's Q&A model. Maybe someone else will have this issue and so i ...
cjbj's user avatar
  • 14.6k
5 votes
Accepted

Hide WYSIWYG editor on certain templates

I hope I understood your question right. The following code will remove the editor from the pages using particular templates: <?php function wpse242371_remove_editor_from_some_pages() { ...
Max Yudin's user avatar
  • 6,318
4 votes

Apply custom style to single word in Wordpress

Solved it... In my functions.php I should have put: array( 'title' => 'Hidden Element', 'inline' => 'span', 'classes' => 'hiddenElement', 'wrapper' ...
JohnG's user avatar
  • 334
4 votes

Convert this textarea to rich html format via wp_editor

You basically have two options, using PHP or Javascript. With PHP you would use the wp_editor function to output the textarea for you, and with Javascript you would convert the existing textarea ...
majick's user avatar
  • 5,091
3 votes
Accepted

remove initial wysiwyg editor from cms page edit

Technically, third party plugins are off-topic for this site. However this is an easy one - in the Custom Fields page in the admin area, go into your field group. Scroll right down to the bottom and ...
Tim Malone's user avatar
  • 4,754
3 votes
Accepted

Can you check if a post WYSIWYG field has an image in it?

There isn't really a built-in way in WordPress to determine if a content field has an image in it, but you can use standard PHP functions to check. For example, I've used a similar technique to check ...
Tim Malone's user avatar
  • 4,754
3 votes
Accepted

Keep WYSIWYG on Blog Page

Pre WP 4.9 if( ! function_exists( 'fix_no_editor_on_posts_page' ) ) { /** * Add the wp-editor back into WordPress after it was removed in 4.2.2. * * @param Object $post * @return ...
RiddleMeThis's user avatar
  • 3,767
2 votes
Accepted

Remove_filter ('the_content', 'wpautop') is not working

Had same problem, fixed with css: <style> p:empty{ height: 0; margin: 0; padding: 0; } </style>
ekerner's user avatar
  • 144
2 votes

How to set WYSIWYG editor width within wp_editor() function?

OK, here's what I just did that works well: echo "<div style='width:75%;'>"; wp_editor( $content, 'myid', $settings ); echo "</div>";
Daniel Payne's user avatar
2 votes

Is it possible to remove WYSIWYG for a certain Custom Post Type?

I will try to do a more complete answer : If you want to remove all the content editor The @Oleg Butuzov answer is good : add_action('init', 'init_remove_support',100); function init_remove_support(){ ...
J.BizMai's user avatar
  • 870
2 votes

Custom settings page TinyMce: no formatting when echoing value of editor

You have to format the output: echo wpautop( stripslashes ( $options['information'] ) ); see: https://codex.wordpress.org/Function_Reference/wpautop
e-colori's user avatar
2 votes

How to wrap the content of the main tinyMCE editor with extra tags

Personally, I style all of the content placed within the WP Editor using just a single class, typically .entry-content which I've used in the example below. When outputting the content from the WP ...
Dave Romsey's user avatar
  • 17.8k
2 votes
Accepted

Content editor creating blank paragraphs in spaces and creating &nbsp in the_excerpt

Judging from your site's content and the comments, you may try using the following CODE in your theme's functions.php file. It'll remove empty <p>&nbsp;</p> tags from post content: ...
Fayaz's user avatar
  • 8,937
2 votes
Accepted

Using main style.css with add_editor_style

The simplest answer is: you can use whatever stylesheet you want for the editor. editor-style.css is just the default stylesheet loaded if none is passed to add_editor_style(). This will load the ...
cybmeta's user avatar
  • 20.5k
2 votes

Extract links from content

I thought regex search may become critical so html dom parser may help. See the code below (if it helps): <?php $post_content = get_the_content(); $dom = new DomDocument(); $dom->loadHTML($...
rony2k6's user avatar
  • 146
1 vote

Wordpress Admin Not Loading All Core Scripts

If there's a bug the Visual tab would just not work, not be missing. The editor scripts would also be failing to load, not missing from load-scripts.php. That the tabs are missing and the script isn't ...
Jacob Peattie's user avatar
1 vote
Accepted

How to add custom tinymce plugin to new text widget

I found the solution with help from Jacob Peattie and the article from https://make.wordpress.org/core/2017/05/23/addition-of-tinymce-to-the-text-widget/ Here's a quick walkthrough on what i did: I ...
Emil Østervig's user avatar
1 vote
Accepted

Problem with using custom shortcode with ACF WYSIWYG field

I got it fixed with below code :) $section_content = get_sub_field('section_content', false, false); $section_content = apply_filters('the_content', $section_content);
aslamdoctor's user avatar
1 vote
Accepted

Stop editor from adding “amp;” after every “&”

One solution is to hook into wp_insert_post_data and do some regex magic to replace all instances of &amp; with &: // when saving posts, replace &amp; with & function ...
Christine Cooper's user avatar
  • 8,798
1 vote

Content editor creating blank paragraphs in spaces and creating &nbsp in the_excerpt

<?php function add_necessary_functions() { function read_more($limit){ $post_content = explode(" ", get_the_content()); $less_content = array_slice($post_content, $limit); ...
Morshed Maruf's user avatar
1 vote

WYSIWYG Wordpress readme.txt file Markdown Viewer

The code used on wordpress.org to render readme files is here: class Markdown. You can download the class and the dependencies, then you should be able to set up a simple custom reader. If you want to ...
fuxia's user avatar
  • 107k
1 vote
Accepted

Creating table layout in WYSIWYG editor

Why you are not using table? Spaces are ridiculus. On WYSIWYG editor select table with 2 columns and 3 rows, align items in left column to left, and in right to center and everything should work fine. ...
Krzysztof Grabania's user avatar
1 vote

Add default text to multiple wysiwyg editors

Not sure exactly how you are adding the editor but with wp_editor() the first parameter is the default content. Codex reference: https://codex.wordpress.org/Function_Reference/wp_editor
Nick Young's user avatar
1 vote
Accepted

How to manage heading font options located in the wysiwyg editor for posts and pages

Here is the link. Now my little answer to your question in the comments: I can't guarantee that anything has changed since then. But I think it is a good base to start to do what you want to. And I ...
wassereimer's user avatar
1 vote
Accepted

TinyMCE not loading in IE8

The hook admin_init is to early for dequeuing, use wp_print_scripts, see examples in the Codex. define( 'SCRIPT_DEBUG', true ); will prevent combining dashboard scripts, so if that works for you on ...
Nabil Kadimi's user avatar
  • 2,686

Only top scored, non community-wiki answers of a minimum length are eligible