Custom fields are a WordPress feature that enables users to add information when writing a post. WordPress stores this information as metadata. Users can then display the metadata by using template tags in their WordPress themes.
Essentially, custom fields allow users to hold extra information related to pages or blogs they are editing, custom post types, or taxonomies (like tags and categories).
How Do Custom Fields Work?
By default, when you write any content type, WordPress saves it into two areas. The first is in the body of the content you add using the post editor. The second is the information about that particular content – for example, title, author, date, time, and more. This part of the post is called metadata.
WordPress automatically adds built-in custom fields to each post or page you create. By default, the option is hidden on the post edit screen. To display your custom field on the site’s front-end, so it’s not just sitting in your database, you need to edit your WordPress theme files. Alternatively, there are dedicated custom field plugins like Elementor Pro and its dynamic content feature. This lets you display the information quickly and requires no code.
Custom Fields Use Cases
Custom Fields can be used in many ways.
- For instance, when creating a WordPress eCommerce store, you will need to collect a great deal of data on your products. For example:
- Stock status
Customs Fields allow you to store that extra metadata to display your products correctly at the front-end of your store.
- Another use case would be creating a real estate site. The site will include data-filled listings such as:
- Square footage
You could add a custom field for each piece of data to enter fluidly in the back-end editor and then automatically display it on the front-end.
- If you are building a restaurant site, custom fields can effortlessly create and maintain a menu by collecting information such as:
- A dish’s price
- Relevant dietary concerns (for example, you could add checkboxes to indicate if a meal is gluten-free or vegan)
Every time you publish a new dish, it will automatically appear on the menu in the proper format.
Put simply, custom fields are vital to unlocking the power of WordPress as a complete content management system.