# Placeholders

The **Placeholders** functionality allows you to dynamically fill certain Global and Module Settings with user- or post-specific data. These placeholders are replaced with corresponding values at runtime, offering great flexibility in customizing plugin behavior. Here is a list of available placeholders and how to use them:

{% hint style="warning" %}
Leave out the `{` `}` characters in the placeholders. For instance,`%usermeta_{key}%` with the key `my_custom_key` becomes `%usermeta_my_custom_key%`.
{% endhint %}

### **User**

The **User** placeholders allow you to dynamically insert user-related data.

| Placeholder             | Description                                                                                 |
| ----------------------- | ------------------------------------------------------------------------------------------- |
| `%user_login%`          | WordPress username of the logged-in user.                                                   |
| `%user_email%`          | Email address of the logged-in user.                                                        |
| `%display_name%`        | Display name of the logged-in user.                                                         |
| `%user_role%`           | ID of the logged-in user.                                                                   |
| `%usermeta_first_name%` | First name of the logged-in user.                                                           |
| `%usermeta_last_name%`  | Last name of the logged-in user.                                                            |
| `%usermeta_{key}%`      | Retrieves a custom meta value for the logged-in user, where `{key}` is the custom meta key. |

### **Post**

The **Post** placeholders enable dynamic insertion of post-specific data, such as the post's ID, title, and custom meta fields.

| Placeholder        | Description                                                                               |
| ------------------ | ----------------------------------------------------------------------------------------- |
| `%post_id%`        | Displays the ID of the current post.                                                      |
| `%post_title%`     | Title of the current post.                                                                |
| `%postmeta_{key}%` | Retrieves a custom meta value for the current post, where `{key}` is the custom meta key. |

### **Date & Time**

The **Date & Time** placeholders allow you to insert the current date and time into your content or settings. You can customize the format using PHP date strings, and use the local time for the site’s language.

| Placeholder                 | Description                                                                                                             |
| --------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `%date_{date_format}%`      | Displays the current date and time in the specified `{date_format}`, where `{date_format}` is a PHP date format string. |
| `%date_i18n_{date_format}%` | Displays the current date and time in the specified `{date_format}` but in the localized language of the site.          |
| `%yyyy-mm-dd%:`             | Displays the current date in the `YYYY-MM-DD` format.                                                                   |
| `%hh:mm%`                   | Displays the current time in the `HH:MM` format.                                                                        |

### **WooCommerce**

Here are the WooCommerce-specific placeholders that can be used within the [**WooCommerce Upload Integration**](https://wpcloudplugins.gitbook.io/docs/integrations/woocommerce/order-uploads), allowing uploads to be sent to an order related folder.

| Placeholder               | Description                                                         |
| ------------------------- | ------------------------------------------------------------------- |
| `%wc_order_id%`           | Retrieves the ID of the WooCommerce order.                          |
| `%wc_order_date_created%` | Retrieves the creation date of the WooCommerce order.               |
| `%wc_order_quantity%`     | Retrieves the total quantity of items in the WooCommerce order.     |
| `%wc_product_id%`         | Retrieves the ID of the product in the order.                       |
| `%wc_product_sku%`        | Retrieves the SKU (Stock Keeping Unit) of the product in the order. |
| `%wc_product_quantity%`   | Retrieves the quantity of the product in the order.                 |
| `%wc_product_name%`       | Retrieves the name of the product in the order.                     |
| `%wc_item_id%`            | Retrieves the ID of the item in the order.                          |
| `%wc_item_quantity%`      | Retrieves the quantity of the item in the order.                    |

### **Advanced Custom Fields**

The [**Advanced Custom Fields**](#advanced-custom-fields) placeholders pull data from ACF fields, whether user-specific or post-specific.&#x20;

| Placeholder               | Description                                                                          |
| ------------------------- | ------------------------------------------------------------------------------------ |
| `%acf_user_{field_name}%` | Retrieves the value of an Advanced Custom Fields (ACF) field for the logged-in user. |
| `%acf_post_{field_name}%` | Retrieves the value of an Advanced Custom Fields (ACF) field for the current post.   |

### **Forms**

Placeholders that can be used in [**Form Plugin integrations.**](https://wpcloudplugins.gitbook.io/docs/integrations/form-plugins)

| Placeholder     | Description                                                                                                                                                                                                                                             |
| --------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `%input_{***}%` | <p>In your form, assign the CSS class <code>wpcp-use-input-{***}</code> to the input field, replacing <code>{***}</code> with your unique identifier. <br></p><p>For example:<br>CSS Class: wpcp-use-input-email </p><p>Placeholder: %input\_input%</p> |

### **Email Notifications**

The **Email Notifications** placeholders can be used in email templatees.

| Placeholder                 | Description                                                                 |
| --------------------------- | --------------------------------------------------------------------------- |
| `%recipient_name%`          | Name of the user receiving the email.                                       |
| `%recipient_email%`         | Email of the user receiving the email.                                      |
| `%recipient_firstname%`     | First Name of the user receiving the email.                                 |
| `%recipient_lastname%`      | Last Name of the user receiving the email.                                  |
| `%admin_email%`             | Administration email address as set on the WordPress General Settings page. |
| `%user_name%`               | Name of the user executing the action.                                      |
| `%user_email%`              | Email of the user executing the action.                                     |
| `%user_firstname%`          | First Name of the user executing the action.                                |
| `%user_lastname%`           | Last Name of the user executing the action.                                 |
|                             |                                                                             |
| **FILE**                    |                                                                             |
| `%number_of_files%`         | Number of files which are processed for this notification.                  |
| `%file_name%`               | Inserts the name of the file.                                               |
| `%file_size%`               | Retrieves the size of the file.                                             |
| `%file_created%`            | Inserts the creation date of the file.                                      |
| `%file_lastedited%`         | Retrieves the last modified date of the file.                               |
| `%file_description%`        | Provides the file description.                                              |
| `%file_icon%`               | Inserts the icon associated with the file type.                             |
| `%file_cloud_download_url%` | Provides the direct URL to download the file from the cloud.                |
| `%file_cloud_preview_url%`  | Retrieves the URL for previewing the file in the cloud.                     |
| `%file_cloud_shared_url%`   | Inserts the shared URL for the file from the cloud.                         |
| `%file_download_url%`       | Generates a download link for the file. Requires access to the module.      |
| `%file_deeplink_url%`       | Provides the deep link URL for the file. Requires access to the module.     |
| `%file_relative_path%`      | Retrieves the relative path to the file from its storage location.          |
| `%file_absolute_path%`      | Inserts the absolute path to the file from the  cloud storage.              |
|                             |                                                                             |
| **FOLDER**                  |                                                                             |
| `%folder_relative_path%`    | Retrieves the relative path of the folder containing the file.              |
| `%folder_absolute_path%`    | Provides the absolute path to the folder in the  cloud storage.             |
| `%folder_url%`              | Retrieves the URL of the folder.                                            |

### **Site Information**

The **Site Information** placeholders allow you to dynamically insert data related to your WordPress site, such as the site name, current URL, and other site-specific details.&#x20;

| Placeholder     | Description                                       |
| --------------- | ------------------------------------------------- |
| `%site_name%`   | Inserts the name of the WordPress site.           |
| `%current_url%` | Inserts the URL of the current page being viewed. |

### **Other**

| Placeholder             | Description                                                                                                                           |
| ----------------------- | ------------------------------------------------------------------------------------------------------------------------------------- |
| `%uniqueID%`            | ID which is increased every time a module is rendered                                                                                 |
| `%directory_separator%` | Represents the directory separator (`/`) for file paths.                                                                              |
| `%location%`            | Retrieves the user's geo-location, which could include city, country, or other location-based information when the data is available. |
| `%ip%`                  | Retrieves the IP address of the user.                                                                                                 |

{% hint style="info" %}

### Create custom placeholders

You can hook into the plugin [  <mark style="background-color:orange;">**{slug}\_apply\_placeholders()**</mark> ](https://wpcloudplugins.gitbook.io/docs/filters#slug-_apply_placeholders)  hook if you want to start using your own placeholders and fill them using your own data source.&#x20;
{% endhint %}


---

# 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://wpcloudplugins.gitbook.io/docs/developers/placeholders.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.
