Skip to content

Displaying custom user fields

Once you have defined a custom user field and started filling it with data from recipes, forms, or by hand, you can show each user their own value on any page of your site. The Custom User Fields Addon gives you two ways to do it: a shortcode and a block.

The addon requires a Plus or Elite plan. If it is not on your site yet, see Installing the Custom User Fields Addon.

Display a field with a shortcode

Every custom user field has its own shortcode. To copy it:

  1. In your WordPress dashboard, go to Automator > Settings > Addons > Custom user fields.
  2. Find the field in the list and click the copy icon in its Shortcode column.

The custom user fields list showing each field's name, meta key, and shortcode, with the Copy to clipboard button on the first row

Paste the shortcode wherever the value should appear: a Paragraph or Shortcode block in the block editor, or the classic editor. The shortcode names the field by its meta key, for example [[automator_uf meta_key="uacuf_company_name"]].

The shortcode shows the value stored for the user viewing the page, so each logged-in user sees their own data. Visitors who are not logged in see nothing. Depending on what the field holds, good places for it are a profile page, a My account page, or a member dashboard. Here, three shortcodes follow a bold label each:

Three custom user field shortcodes in the editor, each after a bold label: Company name, Address, and Favorite hobby

On the front end, each shortcode is replaced with the logged-in user’s value:

A Profile Info section on the front end showing the user's company name, address, and favorite hobby

Display a field with the Custom User Field block

In the block editor, the Custom User Field block does the same job without a shortcode.

  1. Open the block inserter, search for Custom User Field, and add the block where the value should appear.
  2. Choose the field from the Select a field list in the block. The same choice is available as Field in the block’s Field Settings panel in the sidebar.
  3. To show a value stored under another user meta key, one that is not a custom user field, enable Use custom user meta key in the Field Settings panel and enter the key in Custom user meta key.

Like the shortcode, the block shows the value for the logged-in user viewing the page and outputs nothing for visitors who are not logged in or users with no value saved.

Related: Managing Custom User Fields, Updating custom user field data, Installing the Custom User Fields Addon

Comments (0)

Leave a Reply

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

Back To Top