Saturday, October 24, 2026The WordPress PlaygroundFacebookXPinterest
Glossary

Custom Fields

Sometimes a post needs a little extra information, like a product price, a book's author or a star rating. WordPress stores such details in custom fields. A custom field is a piece of extra data, saved as a name and a value, attached to a post or page.

Custom fields are also called post meta or metadata. In this guide, I will show you how to add them and how to display them.

How Do Custom Fields Work?

Each custom field is a simple pair: a name, also called a key, and a value. For example, a recipe post could have a field named cooking_time with the value "30 minutes." WordPress saves these pairs in the post meta table of your database, usually named wp_postmeta.

Think of them like sticky notes on a file. The file is your post, and each note holds one extra detail. If you are curious, here is how to access the database in WordPress and see the table yourself.

How to Add Custom Fields in WordPress

  1. First, open any post in the block editor.
  2. Now, click the three-dot Options menu at the top right and choose Preferences.
  3. Next, turn on Custom fields and reload the editor when it asks.
  4. Here, scroll below the content to find the Custom Fields panel.
  5. Finally, enter a name and a value, then click Add Custom Field.
Note

Field names that start with an underscore, such as _edit_lock, are hidden from this panel. WordPress and plugins use them to store internal data.

[/notice]

Displaying Custom Fields on Your Site

WordPress does not show custom fields on the front end by default. Your theme or a plugin has to print them. Developers use the get_post_meta() function inside the Loop:

echo esc_html( get_post_meta( get_the_ID(), 'cooking_time', true ) );

The last value, true, tells WordPress to return a single value instead of a list. For bigger projects, plugins like Advanced Custom Fields give you a friendly interface with field types such as text, image and date.

That's all you need to get started with custom fields. Do let us know in the comment box below if you get stuck anywhere.