Getting Started with WordPress Custom Fields

WordPress Custom Fields is one of its most powerful features. In combination with Custom Post Types, they can convert WordPress to a Custom Application Building Tool, not only a CMS.

How to enable Custom Fields

Custom Fields (also known as metadata) are not enabled by default.

To enable them, press the “three dots” link in the Edit Post (or Edit Page) action and select Preferences.

Enable Custom Fields
Enable or Disable Custom Fields

Then, you can define custom fields and enter values. Unfortunately, the interface is poor. All values are inserted as text. You can modify this functionality, by writing custom code.

To display the field in the front end, you can use

Advanced Custom Fields Plugin

However, instead of reinventing the wheel, you may use a plugin.

Advanced Custom Fields plugin (free and pro version) offers an excellent interface to manage a lot of field types (text, number, date, lookup, image upload, google map, relationship, and more).

To display the field in the front end, it offers the get_field() function.

Remark: you don’t have to enable Custom Fields (see above) if you have installed the Advanced Custom Fields plugin. Moreover, the “Custom Fields” switch box is not visible in Preferences.

Reference

Your comments are welcome!

MediSign - EHR for Small Medical Practices

EHR for Small Medical Practices

Medical records. Appointments. Electronic invoicing.

$9/month