18

Here's a way to test the core patch #33300.6 by Andew Ozz, through a test plugin in WP 4.5.2, to try out the text pattern filter. Demo Here's a strikethrough example using ~ $init['wpsetextpattern_inline_patterns'] = '{ strong: { start: "*", end: "*", format: "bold" }, strong2: { start: "**", end: "**", format: "bold" ...


15

In WordPress 4.2 the editor was removed on whichever page was assigned to show Latest Posts for whatever reason. The following function below ( original solution found here by crgeary ) will re-add the editor and remove the notification: You are currently editing the page that shows your latest posts. Here's some information on the hooks used: ...


14

Try this: replace 'theme_advanced_disable' => 'fullscreen' with 'toolbar1'=> 'bold,italic,underline,bullist,numlist,link,unlink,forecolor,undo,redo' Also, remove 'teeny' => true,


10

You can filter the TinyMCE body classes to add or change as needed. It's a string that's pre-populated with some things like post type, so the easiest thing to do is append your additional classes (with a preceding space). <?php function wpse_128380_tinymce_body_class( $mce ) { // you could do things here to detect whatever you need // and use ...


10

There are two parameters that you can use to change the size of the text editor generated with wp_editor(), here there are: $settings = array( 'editor_height' => 425, // In pixels, takes precedence and has no default value 'textarea_rows' => 20, // Has no visible effect if editor_height is set, default is 20 ); If editor_height is provided, ...


10

If you don't need wp_editor in front-end, I think its OK. Here a little bit different option settings with your tinymce init. I use this without wp_editor in front-end. <script> jQuery( document ).ready( function( $ ) { tinymce.init( { mode : "exact", elements : 'pre-details', theme: "modern", skin: "lightgray", ...


9

Yes as per @Nibbr Web Development, TinyMCE editor IDs cannot have brackets. Which is the html field ID, so what we will do is create a different but similiar name for the ID attribute and still use our desired name in for the text area field name, like so. $content = $options['textareafield']; // editor_id cannot have brackets and must be lowercase $...


9

It's been a while, but I came across this topic while looking for a way to enable gutenberg editor on the Blog Page. Didn't find any clue in google, so I dived into wordpress code and found the solution. Here is the code: add_filter( 'replace_editor', 'enable_gutenberg_editor_for_blog_page', 10, 2 ); /** * Simulate non-empty content to enable Gutenberg ...


8

Just to update this as I had to dig in the wp source files $settings = array( 'tinymce' => array( 'toolbar1' => 'bold, italic', 'toolbar2' => '', ), 'wpautop' => false, 'media_buttons' => false, ); I think this had changed with Tinymce 4.


8

I had the exact same problem and found the solution to this. The problem is that the anchor plugin for TinyMCE is not being included as part of the default Wordpress install. So while Wordpress says to include: $buttons[] = 'anchor'; …that's not going to work because the TinyMCE plugin for anchors isn't there. If you go to TinyMCE's website, you can ...


7

The main problem are the missing scripts. The scripts enqueued in _WP_Editors::enqueue_scripts() are never printed. The same is true for _WP_Editors::editor_js(). So you have to do that in your AJAX callback handler. I have written a demo plugin and put it on GitHub: T5 AJAX Editor. There is one class named Ajax_Editor. Its method render() prints the ...


7

I was hunting for a way to do this, and no-one seems to mention the wp_editor_settings filter. This worked for me: function my_editor_settings($settings) { $settings['quicktags'] = false; return $settings; } add_filter('wp_editor_settings', 'my_editor_settings');


7

I suggest using keywords for them. so you would do something like [shortcode attr="single_quote double_quote"]test[/shortcode]. Then, while parsing the shortcode you can change them back.


7

You'd better never disable those actions (what you say). Instead, insert add_filter('the_content', 'MyFilter', 88 ); and create such function: function MyFilter($content){ $tags = array( 'p', 'span'); /////////////////////////////////////////////////// ///////// HERE INSERT ANY OF BELOW CODE ////////// ///////////////////////////////////////...


7

Yes, try this : function remove_editor() { if (isset($_GET['post'])) { $id = $_GET['post']; $template = get_post_meta($id, '_wp_page_template', true); switch ($template) { case 'template_01.php': case 'template_02.php': case 'template_03.php': case 'template_04.php': // ...


6

Add Dashicon All buttons inside the TinyMCE have a class, also your custom button. Include (use wp_enqueue_style() a stylesheet with styling with Dashicons, like the follow example. .myicon:before { content: '\2605'; display: inline-block; -webkit-font-smoothing: antialiased; font: normal 16px/1 'dashicons'; vertical-align: top; } On ...


6

I was able to resolve both defaulting to the Visual editor and hiding the tabs with the following code. Dumped the following in plugin file: add_filter( 'wp_default_editor', array($this, 'default_editor') ); Hide the tabs with this javascript: $('.wp-editor-tabs').remove(); Or hide it with CSS: .wp-editor-tabs{display:none;}


6

Make sure you've registered the stylesheet for the editor: add_editor_style( 'http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css' ); This should be in your functions.php https://codex.wordpress.org/Editor_Style


6

To disable the inline link tool and revert it back to a pop-up screen instead, do the following: In your child theme directory, add the following to your function.php: add_filter( 'mce_external_plugins', 'wpse_236590_link_editor' ); function wpse_236590_link_editor( $plugins ) { $plugins['full_link_dialog'] = plugins_url( 'js/', __FILE__ ) . 'editor....


6

In short: it is in dependence of your context, the data inside your editor. wp_kses() is really helpful, and you can define your custom allowed HTML tags. Alternative, you can use the default functions, like wp_kses_post or wp_kses_data. These functions are helpful in ensuring that HTML received from the user only contains white-listed elements. See https://...


5

Try this function from leighton.com : function override_mce_options($initArray) { $opts = '*[*]'; $initArray['valid_elements'] = $opts; $initArray['extended_valid_elements'] = $opts; return $initArray; } add_filter('tiny_mce_before_init', 'override_mce_options'); Hope that helps.


5

Solved it! Hope somebody else can use it or it answers their problem. If there is a better way please share and tell why. $editor_id = 'custom_editor_box'; $uploaded_csv = get_post_meta( $post->ID, 'custom_editor_box', true); wp_editor( $uploaded_csv, $editor_id ); To save the data: function save_wp_editor_fields(){ global $post; ...


5

If you wait for the SetupEditor event then you can access the editors: add_action( 'admin_print_footer_scripts', function () { ?> <script type="text/javascript"> jQuery(function ($) { if (typeof tinymce !== 'undefined') { tinymce.on('SetupEditor', function (editor) { if (editor.id === 'contentLeft') { ...


5

You can adjust the attachment query in the media library popup, through the ajax_query_attachments_args filter. Here are two PHP 5.4+ examples: Example #1: Show only attachments that where uploaded during the last 24 hours: /** * Media Library popup * - Only display attachments uploaded during the last 24 hours: */ add_filter( '...


5

So, I may or may not go to hell for this, but I made a quickfix plugin that bypasses the inline part and just opens the link editor. You can find it here. I didn't spend much time testing it, if you find problems make issues in github and I will see if I can fix it. The way it works is that I removed wplink as a plugin from tinyMCE, then added wplinkc, ...


5

The solution was to call wp_enqueue_media() along with wp_enqueue_editor().


4

$settings = array( 'tinymce' => array( 'width' => 200 ) ); Gives you a tinymce that is 200px wide. Found it here: http://www.tinymce.com/wiki.php/Configuration When I tried it the background color of my tinymce changed. So maybe you have to tweak that.


4

After struggling with it, found the solution which works, in a callback after you add new element: tinymce.execCommand( 'mceAddEditor', true, element.id ); Its strange that there is zero documentation inside codex.


4

As mentioned in the comments, this is a lack of wp_autop() and other formatting functions that get applied to the the_content filter. The editor does not save <p> tags at all, but later on line-breaks are converted into paragraphs via wp_autop(). For meta content, I like to recreate the default filters. I do this because some plugins add things via ...


4

As you noted, setting quicktags to false removes the "visual" and "text" tabs. So, to leave the tabs you need to set quicktags to true and remove the buttons: $settings = array( 'quicktags' => array( 'buttons' => ',' ) ); wp_editor($input, 'editor_name', $settings); To have this in all quicktags ...


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