wp_editor disable after reaching character count limit

I guess the keyup event is too late. If you use the keypress event instead of keyup, then this seems to work: ed.on( ‘keypress’, function(e) { var content = ed.getContent().replace( /(<[a-zA-Z\/][^<>]*>|\[([^\]]+)\])|(\s+)/ig, ” ); var max = 20; var len = content.length; var diff = max – len; if ( diff < 1 ) tinymce.dom.Event.cancel(e); document.getElementById(“character_count”).innerHTML … Read more

Disable visual editor on one specific page

In your code, calling the action admin_init makes is_admin() unnecessary. And, if not mistaken, is_page() is meant to be used in the front-end… But the solution is the following (based on this Answer): add_filter( ‘user_can_richedit’, ‘wpse_58501_page_can_richedit’ ); function wpse_58501_page_can_richedit( $can ) { global $post; if ( 28 == $post->ID ) return false; return $can; }

How to replace the content of tinyMCE editor in both text and visual mode using jQuery?

The first thing to do is to select the active editor. Here we select the editor using its id, which is content. var activeEditor = tinyMCE.get(‘content’); Then we use tinyMCE’s setContent: var activeEditor = tinyMCE.get(‘content’); var content=”HTML or plain text content here…”; activeEditor.setContent(content); However, if the editor is in text mode to begin with, after … Read more

Featured image shortcode

Register the shortcode, ideally in a plugin or functions.php if you have to. add_shortcode(‘thumbnail’, ‘thumbnail_in_content’); function thumbnail_in_content($atts) { global $post; return get_the_post_thumbnail($post->ID); } Add the shortcode to you post content. [thumbnail] If you want more features, see this post or the pastebin. ADDING CAPTIONS AND LINKS add_shortcode(‘thumbnail’, ‘thumbnail_with_caption_shortcode’); function thumbnail_with_caption_shortcode($atts) { global $post; // Image … Read more

How to display TinyMCE without wp_editor()

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”, menubar : false, statusbar : false, … Read more

Disable WYSIWYG editor only when creating a page

The best way to do this is by adding ‘user_can_richedit’ filter, like so: add_filter( ‘user_can_richedit’, ‘patrick_user_can_richedit’); function patrick_user_can_richedit($c) { global $post_type; if (‘page’ == $post_type) return false; return $c; } Hope it’s useful 😉

Disable h1 and h2 from rich text editor combobox

you can change lots of things about the tinyMCE editor at the tiny_mce_before_init filter. http://codex.wordpress.org/TinyMCE_Custom_Buttons the following will restrict your blockformats to p,h3,h4 and blockquote function wpa_45815($arr){ $arr[‘theme_advanced_blockformats’] = ‘p,h3,h4,blockquote’; return $arr; } add_filter(‘tiny_mce_before_init’, ‘wpa_45815’); EDIT for WordPress 3.9 see link function wpa_45815($arr){ $arr[‘block_formats’] = ‘Paragraph=p;Heading 3=h3;Heading 4=h4’; return $arr; } add_filter(‘tiny_mce_before_init’, ‘wpa_45815’);

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)