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:
Leave out the {
}
characters in the placeholders. For instance,%usermeta_{key}%
with the key my_custom_key
becomes %usermeta_my_custom_key%
.
User
The User placeholders allow you to dynamically insert user-related data.
%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.
%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.
%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, allowing uploads to be sent to an order related folder.
%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 placeholders pull data from ACF fields, whether user-specific or post-specific.
%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.
%input_{***}%
In your form, assign the CSS class wpcp-use-input-{***}
to the input field, replacing {***}
with your unique identifier.
For example: CSS Class: wpcp-use-input-email
Placeholder: %input_input%
Email Notifications
The Email Notifications placeholders can be used in email templatees.
%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.
%site_name%
Inserts the name of the WordPress site.
%current_url%
Inserts the URL of the current page being viewed.
Other
%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.
Create custom placeholders
You can hook into the plugin {slug}_apply_placeholders() hook if you want to start using your own placeholders and fill them using your own data source.
Last updated