Is there are limit to the number of custom fields that a post can have?

Hello,

Pretty straightforward quandary...

I have a custom post type, but let's assume it's any type of post or page. Is there a maximum number of custom fields that can be attached to any given post or page?

Can I have hundreds of custom fields attached to a post or page? Are there any drawbacks to doing this?

Thanks for the input.

-Noah

  • Arun Basil Lal

    Hey Noah,

    There is a limit of 30 by default, but you can increase it if you want to, see this: http://wordpress.org/support/topic/custom-field-limit

    Re: Drawbacks, It just being there wouldn't hurt I think (other than making your database a big bigger for each post). But custom fields are there for a reason and the data on the fields works on a post by post basis. So that means, that many database requests happen on one page load. Anything that happens on a page by page basis is a bit too much, but of course that depends on how big your site is, and how good your host is.

    Hope that makes sense :slight_smile:

  • Noah

    Thank you Arun, I came across that discussion topic at some point as well. But, it seemed like they were talking about the maximum number of custom fields that will show up in the 'Add New Custom Field:' dropdown within the 'Custom Fields' meta box.

    So, I took a look at the source for the 'postmeta_form_limit' hook that they mention in that thread. Indeed that only changes the limit of custom fields that shows up in the dropdown of the meta box.

    I'm not worried about the number of custom fields that will show up in the drop down. I'm just wondering if Wordpress will cut me off at some point.

    -Noah

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.