lanamiro
Lana Miro
Partner Manager
Updated on
Useful Resources

What Are WordPress Custom Fields? Everything You Need to Know

What are WordPress custom fields? How do they work, and why would you use them? In this helpful, informative article, I will dive into this and explain everything you need to know about using custom fields in WordPress.

Table of Contents

What are WordPress Custom Fields, and How Do They Work?

By default, WordPress has a standard set of fields for pages and posts. These include data such as the post title, the main content, the date and time it was published, and the author. WordPress automatically sorts all this out for you whenever you create new content.

However, you can also include additional data for your content using a feature called custom fields. Usually, you can’t see this option on the post editing screen. To see it, click the three dots in the top-right and choose “Options” from the menu.

In the Options popup, check the “Custom fields” option, then click “Enable & Reload”.

Once the post editor has reloaded, you should be able to see the custom fields panel beneath the editing section.

Advantages and Use Cases

One of the most well-known examples of custom fields in action is WooCommerce. If you have an online shop selling various products, there are certain key pieces of information you need to display with the products.

For example product category, price, color, and rating. It can then be helpful for the customers to be able to sort the products by these attributes, for example showing the cheapest or highest rated products at the top of the page. 

Another example is a movie review site on which you want to show each movie’s genre, rating, and a little blurb.

Here is a real example of a travel website: Viajayestudia.es.

wordpress custom fields on travel website example

Here we can see that the duration is five days and the price is from €345. Since this information needs to be displayed for all travel packages, it will be set as a custom field.

Here is another real example: Emyoga, where we have the custom fields of Full Name, Phone Number, and Email Address.

wordpress custom fields on yoga website example

If we scroll down, we can see more custom fields for Week Day, Slot Price, Max Spaces, and Duration.

How to Add WordPress Custom Fields

On the editing screen for a post or page, scroll down to the custom fields meta box.

Enter the name of the custom field you want to add, input its value, and click the Add Custom Field button. Once you are happy with your custom field(s), you can save your post or page, which will store the custom field settings. 

How to display custom fields in WordPress themes

Before you can see the custom field on your website, you need to update your WordPress theme with the custom fields. One way to do this is to edit the theme code, but you should only do that if you are familiar with editing WordPress themes. If not, I have custom fields plugins below, which I will get to in a minute.

But if you want to edit the theme code, this is how you do it.

So, you will need to edit the correct theme file for where you want the custom field to display. For example, if you want to display it on individual posts and pages, edit the file named single.php or content-single.php.

To enter the custom fields code inside the WordPress loop, find a line of code like this:

<?php while ( have_posts() ) : the_post(); ?>

Then add the code before this line:

<?php endwhile; // end of the loop. ?>

The code to add will be like this:

<?php echo get_post_meta($post->ID, 'key', true); ?>

You need to replace “key” with whatever the name of your custom field is. So, in the mood example we used earlier, it would look like this:

<p>Today's Mood: <?php echo get_post_meta($post->ID, 'Mood', true); ?></p>

Save the changes, then view the post or page where you added the custom field, and you should be able to see it displayed as “Today’s Mood: Happy”.

Once you’ve done that, you can use that same custom field in any other post or page on your website. All you need to do is go to the custom meta fields meta box, choose the custom field from the dropdown menu, and input the value.

Then, all you need to do is click the “Add Custom Field” button again like before, save your post or page, and you’re done.

What if you can’t see the custom field in the dropdown in the post edit screen?

WordPress’s default upper limit is set to 30 custom fields in this form, which can create a problem if you have a theme or plugin already using custom fields. In that case, there may already be too many custom fields, and you might not see your new custom fields in the dropdown list.

For those of you comfortable with using code, there is some code you can add to your functions.php file:

add_filter( 'postmeta_form_limit', 'meta_limit_increase' );
function meta_limit_increase( $limit ) {
    return 50;
}

This will increase the limit to 50, but if you still can’t see your new custom fields, you can change it to a higher number.

An easier way to manage custom fields: using a plugin

With the above method, there’s always the chance you could make a mistake with the code. But even if you are familiar with adding code to WordPress, wouldn’t it be better if there was an easier way of managing custom fields?

Thankfully, we already have a complete guide on how you can manage custom fields in WordPress using the JetEngine plugin.

Top 3 WordPress Custom Fields Plugins

There are various plugins available that make the process of adding and managing custom fields in WordPress easier. The top three are Advanced Custom Fields, JetEngine, and Pods. Here I will give you an overview of all three of them so you can decide which plugin is right for you.

Advanced Custom Fields plugin

advanced custom fields wp plugin

Developer: WPEngine.

Features: Advanced Custom Fields is a very popular plugin with over two million active installations and over a thousand 5-star reviews on WordPress.org. It allows you to add fields on demand, add them anywhere, and show them anywhere. It is simple and intuitive but full of powerful features and more than 30 field types.

As with most top WordPress plugins, there is both a free and paid version of Advanced Custom Fields. The free version is fine for most uses. You will be able to use most of the field types, and it will still save you a lot of time and hassle compared to trying to do it all without a plugin.

But the Pro version does have some additional features that are pretty useful, including:

  • Repeater fields are useful if you want to include the same field several times on a post. 
  • ACF blocks enable you to display your custom fields in a block style rather than the standard meta box. This is particularly useful if you are creating a website for a client and want to make it super easy for them to understand the custom field data.
  • Gallery field allows you to upload a bunch of images to one field.

There are other additional features, but these are the ones that stand out the most in the Pro version.

Pricing: Free for the main features, with the Pro version costing:

  • $49 per year to use on one website;
  • $149 per year to use on ten websites;
  • $249 per year for unlimited use.

JetEngine plugin

jetengine custom fields plugin

Developer: Crocoblock.

Features: JetEngine is a cost-effective toolkit enabling you to create new custom fields and build a dynamic website structure quickly. In the integration with JetPlugins, it is an excellent choice for creating a WooCommerce shop with catalog and product pages, advanced filter, custom shop pages, and a custom mega menu. 

It seamlessly integrates with many other WordPress plugins, including Elementor Pro, Advanced Custom Fields, RankMath, Yoast, and SEOPress.

It comes with 17 widgets: Data Store Button, Dynamic Chart, Dynamic Table, Check Mark, Map Listing, Project Subpage Content, Profile Menu, Booking Availability Calendar, Order Form, Dynamic Terms, Dynamic Repeater, Dynamic Meta, Dynamic Link, Dynamic Image, Dynamic Field, Calendar, and Listing Grid.

Pricing: It costs $43 per year, which includes support and updates. Alternatively, you can get it as part of a Crocoblock subscription, which includes 150 widgets across 20 plugins.

Pods Plugin

pods custom fields plugin

Developer: Pods Framework Team.

Features: Pods is a relatively popular plugin with over 100,000 active installations and over 340 5-star ratings on WordPress.org.

It enables you to extend any content type by easily adding custom fields to it. You can create custom post types, custom taxonomies, and settings screens. You can display fields anywhere using Pods Blocks and shortcodes and connect your content to anything in WordPress. It’s also great for embedding forms within your pages. 

Pricing: All the main functions of Pods are free, but there is a Pro add-on pack that costs $79 per year for a single site or $119 per year for unlimited sites. It includes the following add-ons:

  • List Tables;
  • Page Builder Toolkit;
  • Advanced Relationship Storage;
  • TablePress Integration;
  • Advanced Permalinks;
  • WPGraphQL Integration.

FAQ

What is a custom field in WordPress?

Custom fields are metadata that enable you to add custom data to your WordPress website content.

What are custom fields used for?

You can use them for any data you want to include on a website. They are particularly useful on shopping websites, for example, where they can be used to display attributes such as price, color, size, etc.

How do I enable custom fields in WordPress?

Normally, you can’t see this option on the post editing screen. To see it, click the three dots in the top-right and choose “Options” from the menu that appears. Then, in the Options popup, check the “Custom fields” option, then click “Enable & Reload”.

How do I create a custom field in WordPress?

The best way to add and manage custom fields in WordPress is to use a plugin. Please see our detailed guide on managing custom fields in WordPress using the JetEngine plugin.

What are Advanced Custom Fields in WordPress?

Advanced Custom Fields is a very popular WordPress plugin that makes adding and managing custom fields easy. To read about this, please see the Top 3 WordPress Custom Fields Plugins section above.

Now You’re Ready to Use Custom Fields in WordPress

So, there you go. I hope you found this guide to WordPress custom fields helpful and informative. First, I looked at what custom fields are and how they can be used. I then showed you how to manually add custom fields and manage them using code. Finally, I gave an overview of some of the top custom fields plugins available.

Have you been using custom fields on your WordPress website? Do you manage them using code, or do you have a favorite plugin? Please let us know in the comments below.