Skip to main content

Custom Post Types vs. Repeating Custom Fields in WordPress

April 9th, 2020

Whenever I start a new custom WordPress project, the first thing I do is break down the content types within it. I identify what templates will be rooted in custom fields or custom Gutenberg blocks and what pieces of the content is a good fit for custom post types. How do you identify what pieces work best for custom post types?

Custom post types are perfect for repeating pieces of content. Common WordPress custom post types include content pieces like:

  • Products in an ecommerce store
  • Team members on an About page
  • Recipes on a recipe blog
  • Press items on a Press page
  • Locations in a store locator
  • Projects in a portfolio
  • Etc.

Being able to quickly identify the appropriate uses for custom post types is essential to custom WordPress development. This portfolio site, for example, has a “Portfolio” custom post type for each project in my portfolio of work. Premium Plugins has custom post types for each of the plugins in the directory.

WordPress Custom Post Types vs. Custom Fields

Sometimes in a build, there is a repeating content structure but it’s a small count to where it may make more sense to do a small repeating set of custom fields, like an ACF repeater field, vs. a custom post type. However, you must be careful when choosing this route when it comes to project scalability.

Custom post types scale infinitely better than repeating custom fields. If you go the custom fields route and your content grows substantially, you may eventually get in a situation where your newly added items aren’t saving because you’re hitting up against your PHP max_input_vars setting. In other words, any given page or post can only have so many custom fields attached to it by default.

Sure, you can adjust this via the PHP.ini file but the need to do so is usually indicative of a misstep happening at the planning level for content.

Are Repeating Custom Fields Ever Appropriate?

Of course! I’m a big fan of the ACF repeater field and I utilize it often. My general rule of thumb is if a repeating content set is < 10 items and is not a good candidate for eventually outgrowing that count, a repeater is a great fit vs. cluttering up the admin menu with a ton of custom post type areas.

One place I love utilizing repeaters is for sliders and carousels. It’s typically a repeating set of content getting things like an image, maybe a link, maybe some text that’s involved and it maxes out at 5-7 or so items. Perfect.

Sometimes I utilize repeaters for things like social media links. It’s another perfect candidate: repeating content and a smaller count that isn’t likely to scale greatly in the future.

Overall

Being able to work with both custom post types and repeating custom fields is an important part of building in WordPress. Weighing the pros and cons of any use is important. If you misstep in this area and become overly reliant on custom fields for repeating content, you could be creating scaling issues for your project or your client’s project down the line.

MORE: WordPress Development

Related Articles