Docs Vector ExpressionsReferenceData Roots FREE

Data Roots

Data Roots are the top-level context objects available to every expression. They are resolved from WordPress’s current request context server-side.

user

Represents the currently logged-in user (or a guest state if not logged in).

PropertyTypeDescription
user.is_logged_inBooleantrue if the current visitor is authenticated
user.idIntegerThe WP User ID
user.nameStringThe user’s display name (alias for display_name)
user.loginStringThe username — returns null for anonymous visitors
user.emailStringThe user’s email address — returns null for anonymous visitors
user.rolesArrayThe user’s roles (e.g., ["administrator"], ["subscriber"])
user.registeredStringRegistration date (raw YYYY-MM-DD HH:MM:SS)
user.urlStringThe user’s profile URL
user.meta.*MixedAccess public user meta by key. Protected meta (_ prefix) and sensitive keys (pass, token, secret, auth, etc.) are blocked

NOTE

user.email and user.login are gated behind authentication — they return null for anonymous (logged-out) visitors, even if used inside a block with visibility set to logged-in users.

Example:

{{ user.is_logged_in ? user.name : "Guest" }}
{{ user.roles[0] == "administrator" ? "Admin Panel" : "" }}

post

Represents the current post, page, or custom post type in the loop context.

PropertyTypeDescription
post.idIntegerThe post ID
post.titleStringThe post title
post.slugStringThe URL slug (aliased from post_name)
post.typeStringThe post type (e.g., post, page)
post.statusStringThe post status (e.g., publish, draft)
post.authorIntegerThe post author’s user ID
post.author_nameStringThe display name of the post author
post.dateStringThe publish date — raw YYYY-MM-DD HH:MM:SS; use | date to format
post.contentStringThe full post content
post.excerptStringThe post excerpt
post.urlStringThe full permalink URL
post.meta.*MixedAccess public post meta by key. Protected meta (_ prefix) and sensitive keys (pass, token, secret, auth, etc.) are blocked

Example:

{{ post.title }}
{{ post.author_name | upper }} • {{ post.date | date "F j, Y" }}
{{ post.meta.card_type | match event="Workshop" | default "Resource" }}

site

Represents global site-level data.

PropertyTypeDescription
site.nameStringThe site name (from Settings)
site.descriptionStringThe site tagline/description
site.urlStringThe site home URL
site.languageStringThe site language code (e.g., en-US)

Example:

{{ site.name }}
{{ site.url + "/membership" }}

Extensibility

Additional context roots can be registered by developers using the vector_expressions/context/get filter:

add_filter( 'vector_expressions/context/get', function( $value, $root ) {
    if ( 'crm' === $root ) {
        return [
            'company'    => get_option( 'crm_company_name' ),
            'rep_email'  => get_option( 'crm_rep_email' ),
        ];
    }
    return $value;
}, 10, 2 );

After registering, the custom root is available in expressions:

{{ crm.company }}
{{ crm.rep_email | default "support@example.com" }}

See Developer Extensibility for details.