Easy Guide to Disable Visual Editor Formatting Shortcuts in WordPress

In this tutorial, we will learn how to disable visual editor formatting shortcuts in WordPress.

What are Formatting Shortcuts and How to Use Them?

WordPress 4.3 came with a new feature called formatting shortcuts. It allows users to quickly add common text formatting without removing their hands from the keyboard and without writing any HTML.

  • Using * or  will start an unordered list.
  • Using 1. or 1) will start an ordered list.
  • Using # will transform into h1. ## for h2, ### for h3 and so on.
  • Using > will transform into blockquote.

Editor shortcuts

Disabling Visual Editor Formatting Shortcuts

While we think that formatting shortcuts are awesome, some users are finding this feature a bit confusing and distracting.

If you want to disable the formatting shortcuts in WordPress, then follow the instructions below:

Copy and paste this code in your theme’s functions.php file or in a site-specific plugin.

function disable_mce_wptextpattern( $opt ) {
 
    if ( isset( $opt['plugins'] ) && $opt['plugins'] ) {
        $opt['plugins'] = explode( ',', $opt['plugins'] );
        $opt['plugins'] = array_diff( $opt['plugins'] , array( 'wptextpattern' ) );
        $opt['plugins'] = implode( ',', $opt['plugins'] );
    }
 
    return $opt;
}
 
add_filter( 'tiny_mce_before_init', 'disable_mce_wptextpattern' );

This code simply removes text formatting shortcuts from your WordPress visual editor. Your other WordPress keyboard shortcuts will work as usual.

We hope this tutorial helped you disable visual editor formatting shortcuts in WordPress 4.3 and later versions.