Skip to content

Current User

The Current User node returns the currently logged-in WordPress user's profile data. Use it to personalize content, filter data by the current user, or implement user-specific features.

Configuration

PropertyTypeDefaultDescription
metaFieldsstring--Comma-separated list of user meta keys to include (e.g., phone,company,avatar).

Input

This is a source node -- it has no input port.

Output

Returns a single user object (not an array of rows):

json
{
  "logged_in": true,
  "id": 5,
  "email": "john@example.com",
  "display_name": "John Doe",
  "login": "johndoe",
  "roles": ["subscriber"],
  "capabilities": ["read", "level_0"],
  "meta_phone": "+1-555-0123",
  "meta_company": "Acme Corp"
}

When not logged in

json
{
  "logged_in": false,
  "id": 0,
  "email": "",
  "display_name": "",
  "login": "",
  "roles": [],
  "capabilities": []
}

How It Works

  1. The node checks if the current visitor is logged in via is_user_logged_in().
  2. If logged in, it fetches the user object via wp_get_current_user() and extracts core profile fields.
  3. If metaFields is configured, each listed meta key is fetched via get_user_meta() and added to the output with a meta_ prefix.

Meta Field Naming

Meta fields are prefixed with meta_ to avoid collisions with core fields. For example, a meta key phone becomes meta_phone in the output.

Example Use Cases

Display a personalized greeting

Connect to a Template node:

template: "Welcome back, `{ {row.display_name}}`!"

Filter orders by current user

Connect to a Table Query node:

tableId: 5
whereField: "user_id"
whereOp: "="
whereValue: "`{ {input.id}}`"

Show different content based on role

Connect to an If/Else node:

condition: "'administrator' in row.roles"

Build a user profile page

metaFields: "phone,company,bio,avatar_url,address"

This outputs all core fields plus meta_phone, meta_company, meta_bio, meta_avatar_url, and meta_address.

TIP

Combine with Require Auth to ensure the user is logged in before accessing protected data.