I'm working with a set of large Wordpress installs with 50-150k posts, each with 40-50 custom fields. The installs are very basic, with limited plugins (less than 5), and a default Wordpress theme (i.e. twenty twelve, etc.). The sites are on 1-Core, 2GB RAM, SSD VPS servers.

These are all private installs, with no public front-end or web traffic. Automatic updater, auto-update core, and revisions are all disabled.

I have no featured images or other media on the edit post page; Only text. The sites are on Wordpress 5.6 or later (I understand they could be updated to 5.9.3, but doubt that is the issue).

The admin edit post page hangs for 25-45 seconds when accessed, and then finally loads. Is there any way to fix or speed this up on a large, basic wordpress install? It appears to be a problem in loading a large amount of custom field data, with 50-100k+ posts.

Here's what I've found:

  • Most other wp-admin pages such as categories, tags, pages, users, settings, etc. load quickly in a few seconds (3 seconds or less). The "All Posts" page takes a little longer at about 8-10 seconds or so.
  • If I don't use the classic editor plugin, and don't enable the custom fields section to load in the new block editor, the edit page will load quickly as well (3 seconds or less).
  • Disabling any other (or even all plugins) has no effect.
  • I can load the front-end post page, and display all of the custom fields with no problem, under 3 seconds.

Any ideas? Is there a problem with the core Wordpress backend functions at this scale for post pages with many custom fields?


  • 1
    The custom fields are all saved as post_meta so I'm thinking it's just volume at this point... ...perhaps some of the custom fields can/should be converted to custom taxonomies instead, if possible. I don't know if this would help but perhaps finding hosting that will allow for additional PHP workers may help. (It may not, but I've seen performance improvements on FlyWheel when they bump up the number of PHP workers.) Commented May 19, 2022 at 3:01
  • Thanks for the quick reply! The odd thing is that I can load all 50 custom fields quickly on the front-end. It's only the backend edit post page where issues arise. That's why I'm trying to see if it's a core function or something...
    – dfcode3
    Commented May 19, 2022 at 3:54
  • 1
    Use eg QueryMonitor plugin to find the bottlenecks, eg what exactly slow db queries are there.
    – birgire
    Commented May 19, 2022 at 4:46
  • Are you using PHP 7.x or 8.x because it's much faster than 5.x. You can check also the network tab in the dev tools, to see if maybe there's some problem with getting some external scripts maybe? Also what DB table engine do you use MyISAM or InnoDB, I didn't do any benchmarks but from what I've read MyISAM has is simpler and thus faster in many scenarios.
    – Picard
    Commented May 19, 2022 at 19:30
  • Yep. PHP 7.4.29. I'm going to try the QueryMonitor plugin first and see what I can tell. As for the DB engine, all of these tables are InnoDB. I didn't change anything, so it's probably the default engine on my server. I'll look into that as well. Thanks!
    – dfcode3
    Commented May 23, 2022 at 22:20

1 Answer 1


I used the QueryMonitor plugin, as birgire suggested in the comments, and found that a core Wordpress Meta Query is causing the problem.

The issue and core Wordpress Meta Query are discussed in depth at CSS Tricks and in another question on Wordpress StackExchange here.

Basically, there's a query that populates the "Select" box for adding a custom field name on the "Edit Post" page (see below).

enter image description here

It goes through the database, and grabs all of the meta keys (or custom field names) in your posts to create a list of previously used keys/names. This makes it easy to use the Select box to choose a key/name you've already used, rather than typing it over and over.

Apparently, the query is not efficient and causes massive performance issues when scaled to 100K+ posts with lots of custom fields.


At this time, there is no absolute/easy fix I could find. CSS Tricks and others have more complicated fixes, but I really wanted something simple. Fortunately, there is an easy workaround StackOverflow user Nic Bug suggested that seems to solve the loading issue for me:

function set_postmeta_choice( $string, $post ) {
$meta_keys = array();
foreach(has_meta( $post->ID ) as $meta){
    $meta_keys[] = $meta["meta_key"];
return $meta_keys;
add_filter( 'postmeta_form_keys', 'set_postmeta_choice', 10, 3 );

Just place this at the bottom of the functions.php file in your theme folder. This shrinks the query down to only find the custom field keys/names used in the current post, rather than all posts.

So, it's a tradeoff. It restores the speed, performance, and loading time, but makes this Select Box less convenient for adding more custom fields.

Your Answer

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

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