Blog · Gutenberg
User Field block for WordPress
Show a field from the logged-in user’s WordPress profile (first name, display name, email, and more). Guests see an optional fallback.
Get Blockenberg
Free Gutenberg block in Blockenberg. The inspector controls and front-end behavior on this page come from this block’s source, not a shared stub.
What it actually does
Show a field from the logged-in user’s WordPress profile (first name, display name, email, and more). Guests see an optional fallback.
Inspector panels on this block: Field, Guests & empty values, Color. Those titles come from index.js, not from a shared template.
Behavior controls: “Profile field” (Shows the logged-in user’s value on the front end); “HTML tag” options: span, p, div, h2, h3; “Field — Alignment” options: Left, Center, Right; “Fallback text for guests” (Shown when the visitor is not logged in (leave blank to show nothing if “Hide when empty” is on)).
Server render lives in render.php. Functions: bkbg_user_field_allowed_fields, bkbg_user_field_get_value, bkbg_user_field_typo_css_vars, bkbg_render_user_field_block.
Allowed values resolved in PHP: First name (`first_name`), Last name (`last_name`), Display name (`display_name`), Nickname (`nickname`), Username (`user_login`), Email (`user_email`), Website (`user_url`), Biographical info (`description`).
The current logged-in WP_User is resolved on each front-end request.
Where to find it
Gutenberg inserter → Blog → search “User Field” (block name `blockenberg/user-field` in block.json). Style it in the sidebar after insert.
How to use User Field block for WordPress
- Install Blockenberg. Install from WordPress.org and activate the plugin.
- Insert the block. Edit a page, click +, search for “User Field”, insert it. Category: Blog.
- Configure inspector controls that exist on this block. Open Field. Set “Profile field”, “Prefix”, “Suffix”, “HTML tag”.
- Publish. Save the page. Output is the saved block HTML; typography/colors follow Blockenberg shared panels.
Inspector controls from this block’s code
| Control | What the code does |
|---|---|
| Profile field | Select control; the chosen value is saved on the block. Shows the logged-in user’s value on the front end. Options: First name; Last name; Display name; Nickname; Username; Email; Website; Biographical info. block.json default: first_name. Saved as `field`. |
| Prefix | Text field in the inspector. Saved as `prefix`. |
| Suffix | Text field in the inspector. Saved as `suffix`. |
| HTML tag | Select control; the chosen value is saved on the block. Options: span; p; div; h2; h3; h4; strong; em. block.json default: span. Saved as `htmlTag`. |
| Field — Alignment | Select control; the chosen value is saved on the block. Options: Left; Center; Right. block.json default: left. Saved as `textAlign`. |
| Hide when value is empty | On/off toggle in the inspector. On by default. Saved as `hideWhenEmpty`. |
| Hide entirely for logged-out visitors | On/off toggle in the inspector. Off by default. Saved as `hideForGuests`. |
| Fallback text for guests | Text field in the inspector. Shown when the visitor is not logged in (leave blank to show nothing if “Hide when empty” is on). Saved as `guestFallback`. |
| Text Typography | Shared Blockenberg typography popover (family, size, weight, spacing). Saved as `typoText`. |
| Text color | Color control in the inspector. Saved as `textColor`. |
When this is the right block
- Show a field from the logged-in user’s WordPress profile (first name, display name, email, and more). Guests see an optional fallback — that is the job of User Field, not a generic content block.
- Use it when you need the editor control labeled “Profile field”, which exists on this block’s inspector.
- It matches pages about user, profile, first name.
- Inserter grouping: posts, magazines, and editorial WordPress pages.
Notes from the implementation
render.php is a dynamic block callback — HTML is built in PHP on each request.
FAQ
How do I add the User Field block in WordPress?
Install Blockenberg from WordPress.org, edit a page in the block editor, click +, and search for “User Field”. It sits under Blog. After insert, open Field and set “Profile field”, “Prefix”, “Suffix”, “HTML tag”.
Can User Field show each visitor’s own data?
Yes. PHP resolves the current user on each request. Guests see the fallback or the block stays hidden — that is in render.php.
Is the User Field Gutenberg block free?
Yes. User Field ships inside Blockenberg. Get the plugin from WordPress.org — no paid add-on is required for this block.
Can I style User Field to match my theme?
Yes. Blockenberg’s shared typography and color panels apply here, plus any block-specific style controls listed on this page (panels: Field, Guests & empty values, Color).
Related blog blocks
Article Header
Rich editorial-style article/blog post header with category badge, headline, subheadline, author meta bar, and optional hero image.
Article Series
Multi-part series navigator showing all articles with the current one highlighted and progress indicator.
Book Review
Rich book review block with cover image, star rating, details grid, pros & cons, and Schema.org Book + Review structured data for SEO.
Book Shelf
A visual reading list with a realistic bookshelf view, cards layout, or list — complete with ratings, reading status, and genre tags.
Category Grid
Display WordPress post categories in a responsive grid with post counts, icons, descriptions, and rich styling options.
Changelog
Versioned release-notes block with colour-coded categories (New, Improved, Fixed, Deprecated). Perfect for SaaS product pages.
Get Blockenberg
Install Blockenberg from WordPress.org, then insert User Field from the Gutenberg inserter.