How to Create Custom Fields in WordPress: Step by Step Guide

When you build a WordPress website, the default editor gives you only basic fields like title, content, and featured image. But sometimes, your website needs more specific details such as product prices, project dates, team member roles, or client information.

This is where custom fields become useful. Custom fields let you add extra information to your posts or pages and display it exactly where you want. You can create them easily using built in WordPress tools or the Advanced Custom Fields plugin.

In this guide, you will learn how to create custom fields in WordPress, how to use them correctly, and how to display them on your website without any coding confusion.


What Are Custom Fields in WordPress

Custom fields are extra data fields that you can add to your posts, pages, or custom post types. They store additional information that is not part of the main content.

For example, you can create custom fields for:

  • A project completion date
  • A movie release year
  • A product SKU number
  • A real estate property price

Each field has a name called a meta key and a value which is the actual data.


Why Use Custom Fields

Custom fields are useful for many reasons.

  1. More flexibility
    You can display custom information anywhere in your theme.
  2. Better content organization
    They keep your data structured and consistent across posts.
  3. Cleaner layouts
    You can separate design and data to keep your content easy to manage.
  4. Ease of use
    Plugins like ACF make adding fields simple for anyone, even non developers.

Method 1: Create Custom Fields with WordPress Built In Feature

WordPress has a built in way to create custom fields. It is simple but hidden in newer versions.

Step 1: Enable Custom Fields

  1. Open any post or page in the WordPress editor.
  2. Click the three dots in the top right corner of the editor.
  3. Select Preferences, then Panels, and enable Custom Fields (legacy).

You will now see a new Custom Fields section below your post content.

Step 2: Add a Field

  1. Scroll to the Custom Fields area.
  2. Click Enter new to create one.
  3. Give your field a name, for example “subtitle” or “project_date”.
  4. Add the value that should appear on the page.
  5. Click Add Custom Field and then Update your post.

Step 3: Display It on Your Site

To show this field on your website, you need to edit your theme file.

For example, if you created a field called “subtitle,” open your single.php file and insert this line where you want it to appear.

<?php echo get_post_meta(get_the_ID(), 'subtitle', true); ?>

Save the file and check your post. You will see your custom field displayed in that spot.


Method 2: Create Custom Fields with the Advanced Custom Fields Plugin

The built in method works fine, but the Advanced Custom Fields plugin makes it much easier and more powerful. It is ideal for beginners and developers who want flexibility.

Step 1: Install the Plugin

  1. Go to your WordPress dashboard.
  2. Click Plugins, then Add New.
  3. Search for Advanced Custom Fields.
  4. Click Install Now, then Activate.

Step 2: Create a Field Group

  1. Go to Custom Fields, then Add New.
  2. Name your group something like “Project Info” or “Product Details.”
  3. Click Add Field and choose your field type.

You can add many types of fields such as text, image, URL, date picker, or number.

Step 3: Assign Where the Fields Will Appear

Under Location Rules, decide where you want the fields to show up. For example, select Post Type is equal to Post or choose a custom post type like Portfolio.

Step 4: Display Your Fields on the Front End

Now when you create or edit a post, you will see your custom fields under the editor. Add your content there.

To display the field data on your website, place this line in your theme file.

<?php the_field('field_name'); ?>

Replace field_name with your actual field name. For example:

<p>Client: <?php the_field('client_name'); ?></p>
<p>Date: <?php the_field('project_date'); ?></p>

Examples of Custom Field Uses

Custom fields can make your website much more dynamic. Here are a few ideas.

  • Portfolio website: add fields for project title, date, client name, and image.
  • Real estate site: add fields for price, area size, and location.
  • Ecommerce site: add fields for product SKU, color options, and availability.
  • Event site: add fields for date, time, and location.

These fields help you keep your data consistent and display it exactly where it belongs.


Tips for Using Custom Fields

  • Use short, simple field names without spaces.
  • Group related fields together for better structure.
  • Always back up your site before editing theme files.
  • Test your fields on a sample post before adding many.
  • Use ACF for large or complex projects that need multiple data types.

When to Use Custom Fields

You should use custom fields when you want to add structured information to posts or pages. They are ideal for websites that repeat certain data patterns such as portfolios, product listings, or testimonials.

They keep your data organized and make updating content much faster in the future.


Conclusion

Custom fields are one of the most powerful and useful features in WordPress. They allow you to add specific information to your pages, display it wherever you want, and keep your content organized.

Now that you know how to create custom fields in WordPress, try adding a few to your next project. You can use the simple built in option or the Advanced Custom Fields plugin for more control.

Once you start using custom fields, you will find your website easier to manage, more flexible, and better designed for your audience.

Scroll to Top