Speed Up the Custom Fields Meta Box
Skips the slow database query that fills the Custom Fields key dropdown, which can freeze the classic editor on sites with lots of post meta.
Opens WPIDE on
Code
// Keys to offer in the dropdown. Leave empty to show a plain text field for the key.
$wpide_custom_field_keys = array();
add_filter( 'postmeta_form_keys', function ( $keys ) use ( $wpide_custom_field_keys ) {
return null === $keys ? $wpide_custom_field_keys : $keys;
} );
Notes
Existing custom fields on a post are still listed and editable.
How to add this snippet
- Install WPIDE on your WordPress site (it is free) and open Code Snippets.
- Use snippet above adds it from the library in one click. Or copy the code into a new snippet with the same code type.
- It is added inactive: review the code and settings, then switch it on.