Custom Fields are metaboxes that are used to input metadata that is related to your post. When you add a new post in WordPress, you’ll see these draggable boxes which are used for to store information about your post. Examples are author and excerpt. Another is custom fields. If you can’t see custom fields, click on the Screen Options tab and check the Custom Fields box.

WordPress Custom Fields MetaBox

cf1

Here you can add pieces of information to your Post which is then output by your theme. The WordPress Codex provides a useful example of Custom Fields that you might want to add to your Posts:

  • Mood: Happy
  • Currently Reading: Cinderella
  • Listening To: Rock Around the Clock
  • Weather: Hot and humid

While a Custom Taxonomy is way to organise and classify your posts into groups, Custom Fields let you store unique information that applies to your Post, Page, or Custom Post Type.

Uses for Custom Fields

There are lots of plugins and themes around that use Custom Fields for you to add specific information to your Posts, Pages, and Custom Post Types. Examples of this are:

  • Price, weight, and dimensions in your eCommerce store
  • Client name and company for your testimonials
  • Number of rooms, bathrooms, and floor size to your real estate listings
  • Ratings to your gaming reviews
  • Dates, time, and ticket price for your events

Creating Custom Fields

As with Custom Post Types and Custom Taxonomies, you can code your Custom Fields yourself. With a plugin such as Pods, however, you can create Custom Fields through the WordPress interface. Whenever you create a Custom Post Type you can add Custom Fields to that Post Type. In the example below, the number of pages is being added to the Books Custom Post Type.

custom_fields_table

This is then added to the post editing screen for your Books Custom Post Type. The information stored is specific to the post that is being added and can be used for querying and displaying data.

custom_fields_front

Special Note on Custom Fields for Taxonomies and User Objects

It’s worth noting that Pods also allows you to add Term Meta to your Taxonomies and User Meta to your User Accounts so you can have specific information applied to each taxonomy term or additional fields added to the User Account. WordPress supports Term Meta and User Meta natively, so you no longer need to use a separate table to store these fields (in the past these required Table Storage). Just add them like you would any other custom fields and call them with either get_term_meta or get_user_meta.

Skip to toolbar