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" ...


14

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


14

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: ...


11

Short answer: Because there is a hidden widget where the TinyMCE appears first. Long answer (sorry, a very long answer): Go to the Codex and copy the example widget Foo_Widget to make sure we are talking about the same code. Now open your IDE (not an editor) and write a short testing widget as plugin. Starting with a minimal plugin header... <?php /* ...


9

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 ...


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

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", ...


7

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.


7

To get the quicktags to show up, you need to re instantiate them within your ajax oncomplete handler. quicktags({id : 'editorcontentid'}); My ajax success handler looks like this; success: function(data, textStatus, XMLHttpRequest){ //append editor to dom $('#container').append($(data).html()); //init quicktags ...


7

Actually you can include the editor-style.css (or any other stylesheet), just pass a "content_css" value to tinymce that points to a css file: wp_editor( $content, 'editablecontent', array( 'tinymce' => array( 'content_css' => get_stylesheet_directory_uri() . '/editor-styles.css' ) ); So the original ...


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

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, ...


7

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

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

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 ////////// ///////////////////////////////////////...


6

Here is my solution: add_filter('the_editor_content', "firmasite_tinymce_style"); function firmasite_tinymce_style($content) { add_editor_style('assets/css/custom.css'); // This is for front-end tinymce customization if ( ! is_admin() ) { global $editor_styles; $editor_styles = (array) $editor_styles; $stylesheet = (...


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

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.


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....


5

While @s_ha_dum’s solution works fine on a custom plugin page, it will fail if you use TinyMCE on a post editor page after the first editor instance has been called, because it would either affect all editors or at least the editors later on the same page. TinyMCE parses custom styles into its settings during the first run only. How to remove the custom ...


5

That can be achieved with the hooks edit_form_after_title and edit_form_after_editor and proceed like a meta box. I noticed a "glitch", though, if you swap Visual/Html in the custom wp_editors and then publish/refresh the page, their state will be the same as the main editor (the post content). Adjust the post type, page in this example. add_action( '...


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

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

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 ...


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

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': // ...


5

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


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