Increasing the number of items in the WordPress Custom Field dropdown list

WordPress custom fields are arbitrary pieces of information you can attach to every post by simply creating a custom field while publishing the article and inserting certain values in it. Value can be simple text but HTML code as well.

Once added you can call those data via WordPress PHP functions and use it in your templates where you see fit.

Although WordPress does not limit the number of Custom Fields you can add to your posts there is one issue that will arise over time for any site using a significant number of different custom fields.

Once you pass over 30 custom fields added, not all fields will be loaded to the custom field drop-down list. Any extra fields above the first 30 (sorted alphabetically) will be cut out and you may wonder what is happening.

It isn’t your theme or the plugins that are causing this, this is a limitation set in WordPress core.

The issue will only go worse by having or testing too many plugins which rely on custom fields to store data.

Luckily it is easy to raise this limit by simply modifying the postmeta_form_limit value by adding this simple filter to your theme function.php.

function increase_postmeta_form_limit() {
return 120;
}
add_filter('postmeta_form_limit', 'increase_postmeta_form_limit');

This simple snippet will limit the number of dropdown items in the custom fields picker to 120.

Similar Posts