Custom Fields
This guide explains how to output the value of a Joomla custom field and access other properties like its label, ID, or raw value using Smart Tags.
Article Custom Fields
To display the value of a custom field in an article, use:
{article.field.NAME}
Replace NAME with the name (not the label) of your custom field.
Example: If you have a custom field named favoriteColor:
{article.field.favoriteColor}
For more details, see the Article Smart Tag guide.
User Custom Fields
To display the value of a custom field from the current logged-in user, use:
{user.field.NAME}
Example:
{user.field.favoriteColor}
For more details, see the User Smart Tag guide.
Common Syntax and Field Properties
You can access additional properties of a custom field by appending the appropriate keyword after the field name.
Return Raw Value
A custom field has both a value and a raw value, which are different in most cases. To return the field's raw value, use:
{article.field.favoriteColor.rawvalue}
Return Field Label
To return the field's label, use:
{article.field.favoriteColor.label}
Return Field ID
To return the field's ID, use:
{article.field.favoriteColor.id}
Subform Fields
If you’re using a Subform field, you can access its content in various ways.
Let’s assume you have a Subform field named customers, with two nested fields: name and age.
Output All Subform Rows
{user.field.customers}
This returns all subform rows as a bullet list.
Output a Specific Row
{user.field.customers.rawvalue.0}
This returns all values from the first row (index 0).
Output a Specific Field from a Specific Row
{user.field.customers.rawvalue.0.age}
This returns the value of the age field in the first row.
Prevent Shortcodes Parsing
By default, the output of a custom field is processed using Joomla’s content plugin system. This is helpful when your custom field value contains shortcodes or other plugins that need to be parsed before rendering.
However, in some cases, this can lead to unexpected results or conflicts. To prevent plugins (like shortcodes) from being parsed in the field output, you can disable this behavior by adding the prepareCustomFields=false modifier to the Smart Tag.
For example, if you have the Email Cloak plugin enabled and you’re trying to output the value of an email-type custom field, Joomla may automatically cloak the email address. Using this modifier will bypass the content plugin parsing and ensure the email is shown in its original form.
{user.field.email --prepareCustomFields=false}