wordpress

ACF Vs. CMB: WP Custom Field Comparison

by Jamal on September 25, 2013

So these past few weeks I’ve been on a couple of WP projects where I’ve had the pleasure of using the two great Advanced Custom Fields(ACF) plugin and WP Custom Meta Box(CMB) library to add extra meta data functionality. In both projects these two both did a good job for creating custom meta boxes. However, they both did have their own things that made took an extra step than thought should be needed.

So, what we’re going to do now is go over both the positives and negatives of these two to see which would be best for your use!

 

Advanced Custom Fields

 

In short, ACF is a great plugin that will have developers ranging from experienced expert to brash newbie feeling amazing about a part of their code base. This plugin takes the task of creating custom meta boxes in your WP site a breeze, and adds a simple functionality to your backend that is found in other mainstream CMS applicaations like ExpressionEngine and Drupal.

Pros

  • Easy to set up
  • Architect updates code regularly
  • Easy to customize and specify for particular posts and/or categories
  • Variety in fields
  • Export options in PHP and XML
  • Nice interface
  • No coding experience needed

 

Cons

  • Exporting is required to get across environments

 

Custom Meta Boxes(CMB)

 

So just because there is a lot praise being tossed ACF’s way doesn’t take anything away from CMB. CMB is a code library so as apposed to just hitting those magic install and activate buttons in the backend there is actual code to be looked at. To get this set up you simply include the library code into your theme and then make sure to include all the PHP files used for writing your CMB files into your functions.php file in your root theme directory. Easy as pie right!

 

Pros

  • No need to worry about exporting when moving environments
  • Can keep custom post type functions in the same file as your meta boxes
  • Fields are easy and simple to create, just add an array
  • Adds ability to add text title to content sections for extended labeling

 

Cons

  • Actually have to add a new array for EVERY FIELD
  • Could be time consuming if working with tons of fields
  • Would easily confuse newbie devs

 

The Verdict

 

Personally, I could see myself going either way with both. They both do their job well, but there is one that gets the edge based on its simplicity and ease of use for all levels of devs. So with that in mind, I would have to give the edge to ACF.

ACF takes the prize here for being more true to what a CMS should be for the development cycle. A no need to edit a piece of functionality that should’ve already been built into the code framework to get it to work.