post editor changes & to &

I dont know what you are doing with your shortcode but it is good practice to serialize and parse data so that it displays beautifully. Since you need to look for & and not for & just use $data = str_replace(“&”, “&”, $data). Also you could look in the php manual for urldecode() and urlencode(). … Read more

Re Order Editor to be after meta box [duplicate]

This will allow the post editor to be moved like the other sortable post boxes. function move_posteditor( $hook ) { if ( $hook == ‘post.php’ OR $hook == ‘post-new.php’ ) { wp_enqueue_script( ‘jquery’ ); add_action(‘admin_print_footer_scripts’, ‘move_posteditor_scripts’); } } add_action( ‘admin_enqueue_scripts’, ‘move_posteditor’, 10, 1 ); function move_posteditor_scripts() { ?> <script type=”text/javascript”> jQuery(‘#postdiv, #postdivrich’).prependTo(‘#your_meta_box_id .inside’ ); </script> … Read more

Disable the Code View in the content editor?

You can do it in JavaScript, though the downside is you have to do it block by block. You’ll need webpack set up with lodash installed: function removeHtmlEditing( settings, name ) { return lodash.assign( {}, settings, { supports: lodash.assign( {}, settings.supports, { html: false } ), } ); } wp.hooks.addFilter( ‘blocks.registerBlockType’, ‘core/paragraph’, removeHtmlEditing ); There’s … Read more

WordPress 4.6 link edit dialog is too rudimentary

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.js’; return $plugins; } Next create a directory inside your … Read more

Stop certain classes showing up in TinyMCE Advanced Style dropdown

This should be what you’re looking for – put this code into your theme’s functions.php file: add_filter( ‘tiny_mce_before_init’, ‘yourprefix_tiny_mce_before_init’ ); function yourprefix_tiny_mce_before_init( $init_array ) { // filter styles: $init_array[‘theme_advanced_styles’] = “your_style=your_class”; // filter formats: $init_array[‘theme_advanced_blockformats’] = “p,h3,h4,h5”; return $init_array; } This way the only style that will be displayed is your_style. The 3rd line is … Read more

Force TinyMCE editor’s “Toolbar Toggle” to be automatically chosen & expanded

Add below function in your activated theme’s functions.php file. function changeMceDefaults($in) { // customize the buttons $in[‘theme_advanced_buttons1’] = ‘bold,italic,underline,bullist,numlist,hr,blockquote,link,unlink,justifyleft,justifycenter,justifyright,justifyfull,outdent,indent’; $in[‘theme_advanced_buttons2’] = ‘formatselect,pastetext,pasteword,charmap,undo,redo’; // Keep the “kitchen sink” open $in[ ‘wordpress_adv_hidden’ ] = FALSE; return $in; } add_filter( ‘tiny_mce_before_init’, ‘changeMceDefaults’ );

How can i add some static text above the editor?

The best way would be using JavaScript to inject the element. Here’s the gist of the markup for that page: <div id=”poststuff”> <div id=”post-body” class=”metabox-holder columns-2″> <div id=”post-body-content”> <div id=”titlediv”> … other stuff … </div> <div id=”postdivrich” class=”postarea”> … other stuff … </div> </div> </div> </div> The titlediv is the title. The postdivrich is the … Read more