Skip to content

Instantly share code, notes, and snippets.

@mitchellkrogza
Created October 4, 2021 04:38
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mitchellkrogza/edfc5dec07d636dbb2a09f01fbf077c8 to your computer and use it in GitHub Desktop.
Save mitchellkrogza/edfc5dec07d636dbb2a09f01fbf077c8 to your computer and use it in GitHub Desktop.
FIX Slow WordPress Editor
// A fix for the horribly slow WordPress post and product editor
// With many thanks to Jon Brown
// Read about it at https://9seeds.com/wordpress-admin-post-editor-performance/
/**
* Remove Ancient Custom Fields metabox from post editor
* because it uses a very slow query meta_key sort query
* so on sites with large postmeta tables it is super slow
* and is rarely useful anymore on any site
*/
function s9_remove_post_custom_fields_metabox() {
foreach ( get_post_types( '', 'names' ) as $post_type ) {
remove_meta_box( 'postcustom' , $post_type , 'normal' );
}
}
add_action( 'admin_menu' , 's9_remove_post_custom_fields_metabox' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment