What IS a custom field in WordPress? If you’re not familiar with custom fields, you may want to take a peak at the WordPress Codex. In short, a custom field is a bit of meta-data attached to any page or post in your WordPress site. It’s stored in a key/value format and can be useful for assigning bits of uniform data across multiple posts.
I’m going to give a quick usage scenario for a custom field and then share a few links to get you thinking about the wide world of possibilities when it comes to using custom fields in WordPress.
Create that Custom Field
Scenario: Custom Field in Action
Let’s say you’re a travel blogger and you’d like to assign a location to each of your posts. Of course you could include your location as part of your post content, but where’s the fun in that? Maybe you want to use the location name as a design element on the page – wouldn’t it be nice to have style control over that specific piece of meta-data?
Of course it would!
How to Add a Custom Field to a Post
First things first: When in your post editor screen, make sure you have the Custom Fields option checked.
Once that’s done, you’ll see the Custom Fields box as part of your post editor:
Okay, now you’re ready, little travel blogger! For this example, we want the Name of our Custom Field to be Location. The Value is going to be wherever your travels had you for this particular post. Since I’m writing from my home city today, I’ll set the value to Fort Worth, TX.
Note: The first time you add a Location, you’ll have to use the “Enter new” link in the Custom Fields window. In every subsequent post, Location will be in the drop-down menu.
I hope the Location on my next post is Hawaii.
Onward and Outward
Okay, so that’s the briefest of introductions. Check up on the links below to see additional ideas and usage scenarios for custom fields. They are limitless!
Other cool uses for Custom Fields
Here are some other great posts that discuss uses for custom fields:
Extend WordPress with Custom Fields (Smashing Magazine)
Advanced Uses for Custom Fields (screencast by Chris Coyer)
Really want to stretch your brain?
This is a great article to get you started on understanding how custom fields can work in beautiful harmony with custom post types and taxonomies.