Looking to learn more about WordPress custom fields?
You’ve already noticed that some basic information is often shown when writing content for your WordPress account–names of writers, dates, and titles are only a few examples.
Metadata is the term for this type of data, which WordPress normally generates automatically.
You can, however, edit the metadata of your posts and pages using your own WordPress custom fields to show whatever you want. The custom fields tool is usually hidden by default, but it is simple to enable and use. Furthermore, there are plugins that assist in further refining this useful functionality.
We call it the WordPress Custom Fields. That being said, let’s go over the basics, shall we?
What Is WordPress Custom Fields?
Custom Fields is an important and useful feature in WordPress and brings us a very high customization ability.
If you’ve already arrived at WordPress, you’ve probably learned that it’s a great forum for quickly putting together blogs. Custom Fields, which played a key role in WordPress’s rapid growth and ascension to the top of the CMS market over the previous 15 years, is also a part of its actual strength.
Repeating the same information in multiple posts, particularly on content-heavy sites like blogs, can be time-consuming. Using WordPress custom fields, you can complete this task much more quickly. Custom fields in WordPress have given a powerful customization capability, allowing it to meet the needs of nearly 30% of websites worldwide, across all industries. When working with WordPress, you can either build a simple blog or you can’t ignore Custom Fields.
Word Custom fields, on the other hand, are a source of contention. Some claim it slows down requests, whereas others claim it is unsuitable for scaling. To find out the facts, you’ll need to learn more about WordPress’s custom fields database and how to query data from it. Please be patient; we will gradually learn everything there is to know about them.
How Do WordPress Custom Fields Work?
WordPress Custom fields are metadata that you can use to add extra details to the post or page you’re editing. When you create a new article, blog, or any other form of content, WordPress saves it in two places by default.
Article Continues Below
The body of your content, which you add using the post editor, is the first part.
The second section provides details about the material in question. For instance, title, author, date, time, and other details. Metadata refers to the information section of the message.
WordPress adds all of the necessary metadata to each post or page you create automatically.
You can also use custom fields to build and store your own metadata.
What Are the Advantages of Using WordPress Custom Fields?
You should definitely do so. Separating this information into its own custom areas, on the other hand, gives you a lot more versatility. You may, for example:
- Custom fields have the advantage of storing specific values for contacts (customer id, account number, etc.)
- Only the account owner and admins can add custom fields, making it more stable.
- Allows for sub-categories and the inclusion of pre-defined values for data integrity.
- Automatically format the rating on the front end of your site to create a styled review box.
- Ensure that all of your review posts use the exact same formatting.
- Use the review rating to query and sort content. For example, you could create a page that lists all of the reviews where you’ve given a perfect rating, or you could let visitors sort reviews by the review rating.
- Filter options include OR functionality (filter by contacts with customer id: 123 or has requested demo: yes.
Custom fields are ideal for categorizing contacts in special ways. These advantages are magnified for more complex sites. Consider the following scenario: you’ve built a real estate listing website with thousands of homes. You wouldn’t want to make each house’s design by hand, would you?
Imagine having to manually format the number of bedrooms, bathrooms, etc. for every single listing. It will take forever!
Instead, you could use custom fields to fill in the basic details for bedrooms, bathrooms, and other areas, and then let your design format it for each home.
Consider a category that is narrow or has two or more narrow subcategories.
Before you create a custom area, consider if it’s precise enough that it won’t need to be changed often and is exclusive to many contacts.
If that’s the case, a custom field can be put to good use. If you’re storing a Billing ID for customers, for example, you could use a custom zone.
Let’s say you run an affiliate website where you regularly post new product reviews. To clearly show a rating for each product, you can add a custom ‘score’ field to your posts.
How to Enable WordPress Custom Fields?
On the post edit screen, the custom fields option is hidden by default. To see it, go to the top-right corner of the screen and press the three-dot menu, then choose ‘Options’ from the menu.
This will open a popup window where you must pick the ‘Custom fields’ choice from the Advanced Panels. Then, to reload the post editor, press the ‘Enable & Reload’ button.
The custom fields panel will appear below the content editor after the post editor has refreshed.
How to Add WordPress Custom Fields?
Page and post you create in WordPress have their own metadata, which includes information like the title and description. This data is automatically added by the platform using special fields. You can, however, create your own metadata by using WordPress custom fields.
There are two main ways to do this, and we’ll go through both of them in this post. You can do the following:
- Make use of a custom field plugin for WordPress.
- Manually add WordPress custom fields and edit your theme to make them visible.
Use Custom Field Plugin for WordPress
There are numerous plugins available that enable you to easily add custom fields to WordPress. Now we’ll teach you how to use a plugin to add and work with custom fields. A good custom fields plugin will also allow you to collect various types of information in your custom fields, in addition to making custom fields easier to work with. You’ll find field categories for things like:
- Image/file uploads
- Google Maps locations
For this tutorial, we’ll use the free Advanced Custom Fields plugin (ACF), which is one of the most popular options.
Advanced Custom Fields
This plugin is particularly appealing to us because it is simple to use. It also comes with a number of ready-to-use WordPress custom fields that you can add to your website with a few clicks.
WordPress developers can use the Advanced Custom Fields WordPress plugin to assign fields and inputs to page templates and posts for CMS users to fill out. It allows developers to add a variety of field styles, such as text boxes and image uploads, to WordPress without having to write custom code.
Since ACF has its own team of developers who operate the framework and manage the code, using custom-coded controls and maintaining the same code through many WordPress projects is a much more effective solution for us.
To begin, you must first install and trigger the plugin. So go to your dashboard and choose Plugins -> Add New from the drop-down menu. If you’re there, check for “Advanced Custom Fields” in the search bar.
To install the plugin, click the Install Now button next to its name. Wait for the text to adjust to Activate before clicking on it again.
When the plugin is installed and enabled, a new Custom Fields tab will appear in your dashboard. If you click it, a list of WordPress custom field groups will appear, all of which should be empty.
Let’s fix that by pressing the Add New button at the top of the page. The plugin will then walk you through the process of building a group with several WordPress custom fields.
To begin, go to the top of the screen and click the Add Field button. Then, for your new sector, choose a label that will also serve as its name. You’ll also want to decide what sort of field you want to create at this stage.
Here are the two most important options:
Field Label – This is the field’s name. This will also populate the Field Name box, which is how you’ll refer to this field programmatically (if needed).
Field Type – The type of data you want to collect is defined by the field type. You can choose from a variety of options, including text, number, email, URL, picture, date picker, and so on.
Let’s make an email field in this example.
Then, to let other users on your site know what to do with your custom area, you may want to write a set of instructions. This phase isn’t needed, but it’s a good habit to get into.
You can tinker with a few more advanced settings, but let’s move on for now. When you close the editor, your new field will be visible in the community list.
After that, you’ll have to decide when and where this custom fields category will appear. This can be done through the Location settings. Show this field category if is a choice that you can use to customize the view settings.
We set up the custom field to appear on regular posts in this example.
Using the Add rule group button, you can add more than one location to show your new WordPress custom fields.
There’s one more section here that allows you to customize where the field appears on the WordPress editor tab. It will appear by default under the text editor, which we’ll show you in a moment. For the time being, remember to save your new custom field by pressing the Publish button.
Your area is now ready to be used. It should appear at the bottom of the screen when you open the WordPress editor for one of your articles.
Keep in mind that the Advanced Custom Fields plugin can only be used to generate fields, not to view them on your website. By default, the field will only appear in your dashboard, and its value will be saved in the database by WordPress.
Manually Add WordPress Custom Fields and Edit Your Theme to Make Them Visible
To begin, go to the custom fields meta box in the post or page where you want to add the custom field.
Next, you need to provide a name for your custom field and then enter its value. Click on the Add Custom Field button to save it.
You can edit this custom field at any time and save your changes by clicking the update button. You can also remove it if necessary. You can now save your post in order to remember your custom field settings.
How to Display WordPress Custom Fields?
Adding custom fields to your WordPress site allows you to view more detail about your content and can help you rank higher in Google and other search engines. However, non-technical users can find it difficult to understand how to display custom fields.
There are also numerous plugins that allow you to add advanced custom fields such as inputs, checkboxes, and selects, among other things. One of our favorite plugins to display the WordPress Custom field is called Toolset or you can use code to show the custom field on WordPress.
Show Custom Fields Using Code
In WordPress, the default method for displaying custom fields is to:
- Activate the single.php or page.php theme files (via FTP or locally). You can build a child theme if you’re using a third-party theme.
- Find the content feature to list your custom field data after the post or page’s actual information.
- Get the values of custom fields using the get post meta feature, then list them using PHP echo.
Toolset makes it simple to show custom fields on the front end.
- Press Add custom fields in the row of the posting form you want to add custom fields to on the Toolset Dashboard tab.
- To begin, click to choose the type of custom field you want to build.
- Fill in the name of your area in the dialog box that appears. Slug is produced on the fly.
- Other options for your custom field can be set. Different options are available for various types of fields.
You can add more custom fields by clicking the Add New Field button once you’ve finished adding one.
When you’ve finished adding all of the fields you’ll need, press Save Field Group.
You can use a “dynamic source” for any Toolset block’s performance. Turning this option on allows you to select a custom field for that block to display.
Each custom field can only have one value by default. However, you may want to have several values for a single field on occasion.
Making Individual Fields Repeatable
Using a repeating image area, for example, you can quickly add galleries and sliders.
To make this choice available, follow these steps:
- Change the value of the single field in question.
- Look for the choice for a single or repeating sector.
- Allow multiple instances of this field by checking the box.
Please keep in mind that not all fields can be repeated.
We’ll use one of these blocks to show repeated individual fields later when we hear about presenting custom content:
- Use this block to show repeatable fields that aren’t images.
- Use the Slider and Gallery blocks to show image repeatable fields.
Creating Repeatable Classes of Fields
An entire group of fields can be made “repeatable.” For example, if you’re creating a cooking website, you might use a repeatable fields group to store “ingredients” with “name” and “quantity.”
To make a group of repeatable fields, do the following:
- Click the Add New Custom Fields category on the Toolset Custom Fields tab.
- To build a post-field party, select the option.
- Save your key field category with a name.
- Your key group must be allocated to a single post form in order to insert a repeatable group of fields. Select one post form by clicking the Edit button in the Where to include this Field Group section.
- Select the Add New Repeatable Community button, give it a name, and begin adding fields to it.
- You’ll need to build a View to show repeatable field classes.
Phew, hope that’s not a lot!
As you gain experience with WordPress, you can begin to explore and use some of its more advanced features. Custom fields are a great example of a hidden feature that gives you a lot more control over your content.
Custom fields in WordPress allow you to add various types of metadata to your posts and pages. You might, for example, add a custom field that shows each post’s ranking, checkboxes, or even maps. There’s not much you can’t do with WordPress custom fields, and setting them up is easy.
However, most people do not function directly with the native custom fields functionality. Instead, the majority of people can use a plugin.
Simply install ACF or Toolset and start customizing how you and your team enter data. Consider the versatility that custom fields provide when planning your next project. They can handle a wide range of content while allowing for quick site-wide changes.
Being able to tweak and perfect your posts’ and pages’ metadata will lift your website to new heights, whether it’s a review site, an eCommerce marketplace, or even just a friendly blog where you want to share what’s going on in your life.
To get your head around the fundamentals, practice using the functions in your job. From there, you’ll be able to create amazing applications in no time. ‘Til next time, folks!