WordPress User Profile Shortcodes
If you want to use the shortcode builder to create a frontend user profile, or display the profile information of logged-in users anywhere on your site, below are shortcodes available to you.
Table of Contents
[profile-username]
Displays the username of users.
[profile-email]
Displays the email address of users.
[profile-website]
Displays the website URL of users.
[profile-nickname]
Displays the nickname of users.
[profile-display-name]
Displays the display-name of users.
[profile-first-name]
Displays the first-name of users.
[profile-last-name]
Displays the last-name of users.
[profile-bio]
Displays the biography of users.
[avatar]
Displays the user profile picture or avatar. Learn more.
[profile-avatar-url]
Displays the profile picture or avatar of users.
[profile-cover-image-url]
Displays the profile cover-image URL of users.
[profile-post-count]
Displays the number of published posts by users.
[profile-comment-count]
Displays the number of comments written by users.
[profile-author-posts-url]
Displays the author page URL of users.
[profile-date-registered]
Displays the registration date of users.
[profile-cpf]
Displays the custom-field‘s data of users.
E.g. If you have a gender custom field where the key is “gender” the shortcode will be [profile-cpf key="gender"]
Below are supported shortcode attributes.
Attribute | Description |
---|---|
key | Field key of the custom field. |
default | Text to display when custom field data is empty or not found. |
[profile-file]
Displays a link to download/view file custom-field‘s uploads.
Below are supported shortcode attributes.
Attribute | Description |
---|---|
key | Field key of the file custom-field. |
raw | Accepts either true or false . if true, the URL of the uploaded file is returned. |
[profile-post-list]
Displays a list of posts published by users.
Attribute | Description |
---|---|
limit | The number of posts to display. |
[profile-comment-list]
Displays a list of comments written by users.
Attribute | Description |
---|---|
limit | The number of comments to display. |
[profile-hide-empty-data]
An enclosing shortcode useful for only display profile data only if the data exist or isn’t empty.
Say you want to only display users biographies only when they have one written, here’s how to do it.
[profile-hide-empty-data field="bio"]
Your Bio: [profile-bio]
[/profile-hide-empty-data]
Note: nothing will be shown if the bio is empty. If you want to display a message such as “No bio found”, add default
attribute to the shortcode like so.
[profile-hide-empty-data field="bio" default="No bio found"]
Your Bio: [profile-bio]
[/profile-hide-empty-data]
Below are supported shortcode attributes.
Attribute | Description |
---|---|
field | Accepts username , email , website , nickname , display_name , first_name , last_name , bio . It also accepts a custom-field’s key. |
default | Text to show if profile data is empty or not found. |