# WordPress User fields

Fetch and display a WordPress user meta field for the user currently logged in. This shortcode, in essence, wraps around the WP PHP function [get\_user\_meta()](https://developer.wordpress.org/reference/functions/get_user_meta/).

**Easy-to-use examples**

Below are some examples of default WordPress user meta fields. However, plugins often add their own (e.g. [\[WooCommerce\]](https://snippet-shortcodes.yeken.uk/shortcodes/sc-user-meta.html) ) this shortcode will allow you to fetch their fields too.

```
[sv slug="user-meta" field="user_login"]
[sv slug="user-meta" field="first_name"]
[sv slug="user-meta" field="last_name"]
[sv slug="user-meta" field="nickname"]
[sv slug="user-meta" field="email"]
[sv slug="user-meta" field="user_url"]
[sv slug="user-meta" field="description"]
```

**Shortcode Arguments**

The shortcode supports the following arguments:

| Argument          | Description                                | Options | Example                                                                            |
| ----------------- | ------------------------------------------ | ------- | ---------------------------------------------------------------------------------- |
| field             | User meta field to display e.g. last\_name | text    | \[sv slug="user-meta" field="last\_name"]                                          |
| message-not-found | Message to display if field is empty       | Text    | \[sv slug="user-meta" field="last\_name" message-not-found="Last name is missing"] |


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://yeken.gitbook.io/snippet-shortcodes/features/ready-made/premium/wordpress-user-fields.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
