User - Dynamic Shortcodes

Discover the User Dynamic Shortcode: a versatile tool for retrieving user data in WordPress.

Updated over a week ago

This particular shortcode specializes in fetching and displaying user-related information based on specified parameters.

Syntax

{user:field}
  • field represents the user metadata field.

Key Arguments

  • id Specifies the user ID to fetch data for. Requires Power Shortcodes privileges.

    {user:field @ID=3}

  • all When set, returns all values of the specified metadata field.

    {user:field @all}

Examples

  1. Email

    {user:email}

    Retrieves the email of the current user.

  2. User ID

    {user:ID}

    Retrieves the email of the current user

  3. Display Name

    {user:display_name}

    Retrieves the name of the current user.

  4. Registration Date

    {date:{user:registered} @format='d-m-Y H:i'}

    Retrieves the registration date of the current user.
    In this case {user:registered} is used inside the date shortcode to format it.

  5. Specifying User ID

     {user:login@id=10}

    Fetches the login name of the user with ID 10.

  6. User Roles

    {for:role
    {user:roles}
    {get:role}
    @sep=', '
    }

    Returns all roles assigned to the current user. {user:roles} returns an array so we cycled the terms with the shortcode {for}.

Special Privileges

Some actions and information retrieval, such as accessing certain user metadata (e.g., email, login) or specifying a user ID, require the use of Power Shortcodes.
These have elevated privileges to ensure sensitive data is securely handled.

Did this answer your question?