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@keyargs}
  • field_name represents the user metadata field.

  • keyargs comprises additional key arguments for more specific data retrieval.

Key Arguments

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

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

Examples

  1. Basic Usage: {user:email}

    Retrieves the email of the current user.

  2. Specifying User ID: {user:login@id=10}

    Fetches the login name of the user with ID 10.

  3. Using 'all' Key Argument: {user:roles@all}

    Returns all roles assigned to the current user.

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. Usage of these privileged actions must be done cautiously and typically for internal functionalities due to security considerations.

Did this answer your question?