Quick Fix for a Slow WordPress  Admin

Drastically speed up the WordPress admin with 3 lines of code.

WordPress plugins track analytics on the actions you take in the WordPress admin. Some also make remote HTTP connections to display call to action promotional information directly in the admin. In my experience, this is the #1 cause of a slow loading WordPress admin.

Disable Admin Notices

Add the following code to your custom theme or functionality plugin to drastically speed up the WordPress admin (/wp-admin/) on your website.

/**
 * Remove Admin Notices
 */
add_action( 'in_admin_header', function () {
  remove_all_actions( 'user_admin_notices' );
  remove_all_actions( 'admin_notices' );
}, 99 );

Potential Downsides

There are a few potential downsides to this approach that are important to know about. When you add this function to a custom WordPress plugin or theme, you’re effectively shutting off all notices in the WordPress admin. This includes messages that may be important to see:

  • When a premium plugin license expires
  • Information about a critical update that patches a known security concern
  • Functional UI information that’s part of the WordPress core

If you need to keep this functionality, then consider adding rules to the hook callback function that will allow certain messages to pass through. This will preserve the performance gains, and allow you to see those critical messages. If you’re working with a good WordPress developer, these notices probably won’t be necessary. Security issues should be picked up immediately by routine scans, and expired plugins and licenses can be seen directly on the Upgrades and/or Plugins pages.

Real World Results

Here’s a real world example of the performance gains, showing a drop from 2.5 secs to 0.5 secs after removing admin notices. This was done in a localhost environment for my site, which uses very few plugins. Depending on the setup of your website, the gains could be (and probably will be) much more substantial.

Before: 2.5108 secs

Before Removing Admin Notices

After: 0.5449 secs

After Removing Admin Notices

Meet the Author

Kevin Leary, WordPress Consultant

I'm a freelance web developer and WordPress consultant in Boston, MA with 17 years of experience building websites and applications. View a portfolio of my work or request an estimate for your next project.