Home » Articole » EN » Computers » Web development » WordPress » Tips » How to use custom fields in WordPress

How to use custom fields in WordPress

posted in: Tips 0

WordPress has a feature to allow users to assign custom fields in an article. These arbitrary additional information is also known as metadata. These metadata may contain information such as:

  • Mood of the day:

  • Current reading: …

  • I listen to: …

  • Weather: …

With some additional programming, it is possible to manage more complex actions, such as using a meta-data to keep in memory an expiration date of the article.

These meta-data are managed with key/value pairs. The key is the name of the metadata. The value represents the information that must bear the metadata in the list of information associated with each item bringing this metadata.

It is possible to associate the same key several times for the same item. For example, if you read two books at the same time (perhaps a technical book for your work and a novel at home), you can create a key “reading” that you use twice in the same article, one for each book.

Here’s an example of how this information can appear in your article:

Current reading: How to Translate – English Translation Guide in European Union

Mood of the day: Content and happy


Based on the example above, let’s put it into practice. We will add two custom fields, the first is called “Readings” and the second “Mood of the day“. The following instructions show you how to add this information to an article using custom fields.

  1. From the Post > Add New Post or editing a post (Edit Post), click the button Screen Options in the top right side of the page.
  2. Check the option Custom Fields.
  3. After writing your article, go to the bottom of the editing page and look for an area called Custom Fields.
  4. To create a new custom field called “Readings“, click Enter new and type “Readings” key text in the Name text box.
  5. This new key must have an associated value, which in our case is the name of the book that we are reading: “How to Translate – English Translation Guide in European Union“. Type “How to Translate – English Translation Guide in European Union” in the Value box.
  6. Click the Add Custom Field to save this information for this article.

To add your “Mood of the day“, repeat the process with “Mood of the day” in the key and description of your mood in the Value box and then click Save to save this information together with the article.

On your next article, you can add a new book and your mood to your metadata. In the Custom Fields section, the key area now contains a combo with key entered on the previous articles. Choose “Readings” and enter the title of your new book in the Value box. Click Add Custom Field and repeat to add your “Mood of the day“.

Just create once a key, then you can assign a value to this key for all your items if you wish. You can also assign more than one value to a key for the same item. This is very useful for people who read more than one book at a time.

Translated and adapted from wordpress.org

Leave a Reply

Your email address will not be published. Required fields are marked *