A field is a stored Item which can be inserted in:

  • an Admin Page, as an option or a user_meta
  • a User Profile, as a user_meta
  • a Metabox, as a post_meta

Depending on the container, the method used to create a field will differ.

For example, creating a Text field in an Admin page:

Copy to Clipboard

Other example, creating a Text field in an User Profile:

Copy to Clipboard

A field can be loaded everywhere, using the code below for an option:

Copy to Clipboard

… or using the code below for an user_meta:

Copy to Clipboard

… or using the code below for an post_meta:

Copy to Clipboard

The static method get_option decorates the WordPress get_option, to offer a sanitize feature. It is not very important for a Text whose content will not be sanitized before it is stored. On the other hand, a Select, for example, must be transformed back into an array properly before being returned by the admin builder.