Possible to create placeholder images in WordPress editor that are clickable (should bring up uploader)?

such an answer would likely become unworkable/unusable after a WordPress update, as TinyMCE get updated and APIs change – by @TomJNowell While I agree with Tom, there still an be a general answer that explains the general concept and the parts that aren’t moving. The PHP plugin to set the default content First there has … Read more

Disable TinyMCE Drag and Drop

you can solve this problem by enqueue the following script with the dependency of jQuery jQuery(document).ready(function(){ tinyMCEPreInit.dragDropUpload = false; }); To add the dependency you can refer this link I have tested this solution and it has worked for me. I hope it will work for you too.

How can I insert HTML attributes with an existing TinyMCE button?

The following workaround is based on the wpeditimage/plugin.js file in the core. You could enqueue it or test it with: add_action( ‘admin_footer-post.php’, function() {?><script> jQuery(window).load( function( $ ) { if( ! $( “#wp-content-wrap”).hasClass(“tmce-active” ) ) return; var editor = tinyMCE.activeEditor; editor.on( ‘BeforeExecCommand’, function( event ) { var node, DL, cmd = event.command; if ( cmd … Read more

How can the tinyMCE dom be manipulated (offical API does not seem to work)?

Hope You can use fallowing // Sets class attribute on all paragraphs in the active editor tinymce.activeEditor.dom.setAttrib(tinymce.activeEditor.dom.select(‘p’), ‘class’, ‘myclass’); // Sets class attribute on a specific element in the current page tinymce.dom.setAttrib(‘mydiv’, ‘class’, ‘myclass’); or You can add Id by jquery like this $(‘div’).find(‘p’).attr(‘id’, ‘myid’);

How to add TinyMCE keyboard shortcut

Last time i added a keybord shortcut it was using jQuery. take a look at jquery.hotkeys plugin which lets you enable keyboard shortcuts with a simple one liner: $(document).bind(‘keydown’, ‘ctrl+a’, fn); update if you want to check if the TinyMCE editor is active and it has a selected text then here are the functions you … Read more

Second toolbar in tinymce has “display:none” set?

Show the Kitchen Sink by Default Copying @nus’ answer as an answer to help newcomers. If you would like to show that second row of options by default, there’s an easy way. Simply put the following into your theme’s functions.php file: function unhide_kitchensink( $args ) { $args[‘wordpress_adv_hidden’] = false; return $args; } add_filter( ‘tiny_mce_before_init’, ‘unhide_kitchensink’ … Read more

How to set custom editor style when editing the homepage?

If I understand you correctly, you want a custom editor style when editing the homepage? You can check if you’re currently editing the homepage by comparing the post ID to the ID in the page_on_front option, like this: function homepage_editor_styles() { global $post_ID, $post_type; if ( empty ( $post_ID ) || ‘page’ !== $post_type ) … Read more

Tiny MCE not adding p tag when saving theme option

If you want the contents of an option, variables, or anything for that matter to be treated like post content you’ll need to call the post content filters. <?php echo apply_filters( ‘the_content’, $your_var ); ?> Your data is then treated in the same way as post content is, inline with the code sample you’ve posted, … Read more

How to customize the symbols that appear in the Visual Editor insert custom character

This has to do with your character map for tinyMCE it’s located inside: wp-includes/js/tinymce/themes/advanced/js/charmap.js Although I wouldn’t recommend editing the WP-Core you could theoretically just add new characters there like so: [‘&#298;’, ‘&#298;’, true,’I kahako’], [‘&#332;’, ‘&#332;’, true,’O kahako’], and so on… However when you update WordPress this will overwrite those changes. So it’s not … Read more

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