I am managing WordPress server 2Core CPU 8Gb Ram, hosted on Openlitespeed + MariaDB 11.4, PHP 7.4. Redis and OPache are installed. On the WordPress site, Redis Object Cache and Litespeed LSCache are plugins installed and enabled.

Memory Limit: 512MB, Max Execution time: 120

The site has over 140k posts, browsing the site pages and content is a smooth experience.

But the problem is whenever the editor login to create a post, the CPU usage surge to 90% or more. and the wp-admin/post-new.php become as slows as a snail, sometimes I could take more than minutes before it gets ready, sometimes crashed that publish button will be greyed-out. It gets worse when they open multiple instances of wp-admin/post-new.php.

enter image description here

I have tried to disable all plugins, change the theme with the plugin disabled, it doesn't fix.

It only gets a little bit better if I disable Classic Editor, using the default Gutenberg editor.

My Test and Findings

When I install Query Monitor I discovered that a query is running slow taking up to 25 seconds to complete, on other tabs or instances of wp-admin/post-new.php it could read up to 100 seconds, some case makes the site stop responding.

FROM wp_postmeta
WHERE meta_key NOT BETWEEN '_'
AND '_z'
HAVING meta_key NOT LIKE '\\_%'
ORDER BY meta_key LIMIT 30

enter image description here

I thought Installing Redis on the VPS and the Redis Cache Object would give a better performance. This could be true as other parts of the website are fast loading except for the post editor page where the query above is running.

Presently, I have disabled the classic editor, but the user (editors) preferred it. Please what do I need to do more to optimise the site?

1 Answer 1


After searching the web over the night I found out that the problem is common and the same query I posted above is the culprit. According to WordPress Post Editor Performance, this is caused by Slow meta_form() database query

The safest solution he provided was a piece of code the function.php. I did that and I experience a great deal of changed. see code below:

 * 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 wpse391530_remove_post_custom_fields_metabox() {
     foreach ( get_post_types( '', 'names' ) as $post_type ) {
         remove_meta_box( 'postcustom' , $post_type , 'normal' );   
add_action( 'admin_menu' , 'wpse391530_remove_post_custom_fields_metabox' );

You can read more about the solution on the article link posted above

  • please why you have changed the original code "s9" with 'wpse391530' ??? i see in the site you post it that this code wil not work with gutenberg editor.
    – Tomy
    Mar 7, 2022 at 16:27
  • wpse391530 is derived from WordPress Stack Exchange and the question ID 391530
    – Good Muyis
    Mar 10, 2022 at 4:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.