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

Listen to Post action

This is more of a JavaScript the A WordPress Question but anyway, You can use the JavaScript onbeforeunload event something like: <script type=”text/javascript”> old = window.onbeforeunload; window.onbeforeunload = MyOnExit; function MyOnExit(){ //do your stuff here return old(); } </script>

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

Get a button for in the Editor

There’s an easy way. Open functions.php and add this code. It works for many html entities // got this form http://www.sycha.com/wordpress-add-hr-button-tinymce-visual-editor function enable_more_buttons($buttons) { $buttons[] = ‘hr’; /* Repeat with any other buttons you want to add, e.g. $buttons[] = ‘fontselect’; $buttons[] = ‘sup’; */ return $buttons; } add_filter(“mce_buttons”, “enable_more_buttons”); //add_filter(“mce_buttons_2”, “enable_more_buttons”); // add to … 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 to limit edit_form_after_title hook to page and post edit only?

Personally I’d use a different approach, because @Shazzad‘s solution seems too much global dependent, and @s_ha_dum‘s needs 2 hooks instead of one. I’d use get_current_screen function to get a WP_Screen object, then I’d look at its property to run (or not) something after the title: function do_something_after_title() { $scr = get_current_screen(); if ( ( $scr->base … Read more

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