Title: Display custom fields in the frontend &#8211; Post and User Profile Fields
Author: Jose Vega
Published: <strong>24 iulie 2017</strong>
Last modified: 12 ianuarie 2024

---

Caută module

Acest modul **nu a fost testat cu ultimele 3 versiuni importante ale WordPress**.
S-ar putea să nu mai fie întreținut sau susținut și ar putea avea probleme de compatibilitate
când este folosit cu versiuni recente ale WordPress.

![](https://s.w.org/plugins/geopattern-icon/shortcode-to-display-post-and-user-data.
svg)

# Display custom fields in the frontend – Post and User Profile Fields

 De [Jose Vega](https://profiles.wordpress.org/josevega/)

[Descarcă](https://downloads.wordpress.org/plugin/shortcode-to-display-post-and-user-data.1.3.0.zip)

 * [Detalii](https://ro.wordpress.org/plugins/shortcode-to-display-post-and-user-data/#description)
 * [Recenzii](https://ro.wordpress.org/plugins/shortcode-to-display-post-and-user-data/#reviews)
 *  [Instalare](https://ro.wordpress.org/plugins/shortcode-to-display-post-and-user-data/#installation)
 * [Dezvoltare](https://ro.wordpress.org/plugins/shortcode-to-display-post-and-user-data/#developers)

 [Suport](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/)

## Descriere

#### UPDATE

Our plugin now includes a settings page where you must whitelist every field that
you want our shortcode to display in the front end, for security reasons. Your existing
shortcodes will not work until you whitelist those field keys.

The „sanitization” parameter has been removed. All the output is sanitized with 
wp_kses_post always.
 The „wp_filter” parameter has been removed. Now we have more
specific parameters like wpautop=”yes” to turn line breaks into paragraphs, and 
do_shortcodes=”yes” to parse shortcodes.

Display post and user custom fields data anywhere on the frontend using a shortcode,
including advanced custom fields (ACF) fields.

 * Do you want to display information from a user profile on the frontend?
 * Do you want to display custom fields from a post on the frontend?
 * Have you created metaboxes with Advanced Custom Fields and you want to display
   those fields?

Use this plugin to display any field for a post or user profile on the frontend.

#### Basic examples

 * **Display email of the current user**: `[vg_display_data key="user_email" data_source
   ="user_data"]`
 * **Display first name of the current user:** `[vg_display_data key="first_name"
   data_source="user_meta"]`
 * **Display full name of the current user:** `[vg_display_data key="first_name,
   last_name" data_source="user_meta"]`
 * **Display the title of the current post:** `[vg_display_data key="post_title"
   data_source="post_data"]`
 * **Display the excerpt of the current post:** `[vg_display_data key="post_excerpt"
   data_source="post_data"]`
 * **Display the categories of the post ID = 20:** `[vg_display_data object_id="
   20" key="category" data_source="post_terms" template="<b>Categories:</b> {{var}}"
   joiner=", "]`
 * **Get featured image url:** `[vg_display_data key="_thumbnail_id" template="<
   b>Image url:</b> {{var}}" flag="file_url"]`
 * **Get featured image as `<img>` tag.:** `[vg_display_data key="_thumbnail_id"
   template="<b>Image:</b> {{var}}" flag="image_tag"]`

#### Advanced examples

 * **Display the title for the post ID from the URL containing the parameter ?post_id
   =ANY_NUMBER:** `[vg_display_data object_id_type="query_string" object_id="post_id"
   key="post_title" data_source="post_data"]`
 * **Get email of the current user with phone number = 1234 (meta_key=phone AND 
   meta_value=1234):** `[vg_display_data object_id_type="find" object_id="phone:
   1234" key="user_email" data_source="user_data"]`

#### Parameters

 * `object_id` = Post ID. Leave empty to use the current post. Possible values: (
   empty), current, number, query string key if object_id_type=query_string, meta_key:
   meta_value if object_id_type=find
 * `object_id_type` = Leave empty if object_id is empty, or current, or is a number.
   Possible values: query_string, find
 * `data_source` = What database table to use to find the data. Default = post_meta.
   Possible values: post_data, post_meta, user_data, user_meta, post_terms.
 * `key` = Field key. It accepts one or multiple keys separated by commas. For example,
   to display full name = first_name,last_name. Required.
 * `template` = HTML fragment to use to display the field, if the field is empty
   the html is not displayed. Optional.
 * `default` = Default value to use if the field is empty. Optional.
 * `joiner` = If the field has multiple values, it will join the values with this
   string. Default ” ” (one space). Optional.
 * `flag` = Use only if the field contains a file ID to conver the ID to URL or 
   image tag. Default values: file_url , image_tag. Optional.
 * `wpautop` = Whether to turn line breaks into paragraphs. Optional, only for advanced
   users.
 * `do_shortcodes` = Whether to parse shortcodes before displaying the field value.
   Optional, only for advanced users.

## Instalare

#### Automatic installation

Automatic installation is the easiest option as WordPress handles the file transfers
itself and you don’t need to leave your web browser. To do an automatic install 
log in to your WordPress dashboard, navigate to the Plugins menu and click Add New.

In the search field type „Shortcode to display post and user data! and click Search
Plugins. Once you’ve found our plugin you can install it by simply clicking “Install
Now”.

#### Manual installation

The manual installation method involves downloading our plugin and uploading it 
to your webserver via your favourite FTP application. The WordPress codex contains
[instructions on how to do this here.](https://codex.wordpress.org/Managing_Plugins#Manual_Plugin_Installation)

## Recenzii

![](https://secure.gravatar.com/avatar/03353e441d76bd0e9a2a60da37cc95ff5004183278b7c81e3892014f4e49dc6e?
s=60&d=retro&r=g)

### 󠀁[Awesome Plugin – THANK YOU!](https://wordpress.org/support/topic/awesome-plugin-thank-you-20/)󠁿

 [azlivin008](https://profiles.wordpress.org/azlivin008/) 13 octombrie 2023

Thanks for donating this plugin to the WP repository. It is SO helpful, and just
what I was looking for – clean, lite weight and easy to use, I added a native custom
field because I did not need an entire ACF plugin for just one field, but then needed
to figure out how to display it in the sidebar. This was perfect! ACF needs to add
something like this to make it easier for users to display fields on front end.

![](https://secure.gravatar.com/avatar/e4db71a6a7ffdd8a99a1c354068fe7f5e99bd682f967cd2968f9095dfb52fdd2?
s=60&d=retro&r=g)

### 󠀁[Fantastic! This plugin does what exactly I needed](https://wordpress.org/support/topic/fantastic-this-plugin-does-what-exactly-i-needed/)󠁿

 [Md Jahidul Islam](https://profiles.wordpress.org/onetarek/) 1 septembrie 2022

I had a task to pass a custom field value to the setting field of a plugin. That
plugin allows shortcode as a field value. I was thinking to write a custom code 
to get custom field value via shortcode. But what did I think, I searched on google,
and got this cool thing.

![](https://secure.gravatar.com/avatar/3f5a1c2b366752c9fee959cfc9e2673b97fdbed729e4d51d89c90e22b8095efa?
s=60&d=retro&r=g)

### 󠀁[very much needed](https://wordpress.org/support/topic/very-much-needed-4/)󠁿

 [andrew55](https://profiles.wordpress.org/andrew55/) 16 octombrie 2021

Works great. We use it to display user’s first name at different locations. Very
good at giving that personal touch. Please keep this plugin active!!!!!

![](https://secure.gravatar.com/avatar/92972fb5650da5c7614a34911753c1726d7033d6512982d83b372cb0abb8fe8a?
s=60&d=retro&r=g)

### 󠀁[Fantastic](https://wordpress.org/support/topic/fantastic-2737/)󠁿

 [josu2002](https://profiles.wordpress.org/josu2002/) 24 februarie 2021

This plugin save my project i can see everithing about the users

![](https://secure.gravatar.com/avatar/b37f8fdac51015b683bbae88de4f4d04aec652003662fa192272649d054976ab?
s=60&d=retro&r=g)

### 󠀁[Very Powerful!](https://wordpress.org/support/topic/very-powerful-53/)󠁿

 [Clayton Chase](https://profiles.wordpress.org/claytonchase/) 22 septembrie 2020

I’ve used this plugin on several projects and it is very powerful and useful! Deserves
far more downloads.

![](https://secure.gravatar.com/avatar/2f0c117f49b27e69001bdf7255757875094432f788fedea545d8386093372dc8?
s=60&d=retro&r=g)

### 󠀁[Great support and easy to use plugin](https://wordpress.org/support/topic/great-support-and-easy-to-use-plugin-4/)󠁿

 [terrim](https://profiles.wordpress.org/terrim/) 15 iulie 2020

The plugin is really easy to use and the support I received was amazing!

 [ Citește toate cele 8 recenzii ](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/reviews/)

## Contributori și dezvoltatori

„Display custom fields in the frontend – Post and User Profile Fields” este un software
open-source. La acest modul au contribuit următoarele persoane.

Contributori

 *   [ Jose Vega ](https://profiles.wordpress.org/josevega/)
 *   [ vegacorp ](https://profiles.wordpress.org/vegacorp/)

[Tradu „Display custom fields in the frontend – Post and User Profile Fields” în limba ta.](https://translate.wordpress.org/projects/wp-plugins/shortcode-to-display-post-and-user-data)

### Te interesează dezvoltarea?

[Răsfoiește codul](https://plugins.trac.wordpress.org/browser/shortcode-to-display-post-and-user-data/),
vezi [depozitarul SVN](https://plugins.svn.wordpress.org/shortcode-to-display-post-and-user-data/),
sau abonează-te la [jurnalul de dezvoltare](https://plugins.trac.wordpress.org/log/shortcode-to-display-post-and-user-data/)
prin [RSS](https://plugins.trac.wordpress.org/log/shortcode-to-display-post-and-user-data/?limit=100&mode=stop_on_copy&format=rss).

## Istoric modificări

1.3.0 = 2023-01-10
 – Added settings page to whitelist every field that you want
our shortcode to display in the front end. Your existing shortcodes will not work
until you whitelist those field keys. – The „sanitization” parameter has been removed.
All the output is sanitized with wp_kses_post always. – The „wp_filter” parameter
has been removed. Now we have more specific parameters like wpautop=”yes” to turn
line breaks into paragraphs, and do_shortcodes=”yes” to parse shortcodes. – The „
callable” parameter has been removed.

1.2.1 = 2023-04-20
 – Only display fields of the current user

1.2.0
 – Compatibility with wp 6.0 – Improve compatibility with ACF

1.1.3
 – Compatibility with wp 5.8

1.1.2
 – Fix. Array values are returned as „Array”

1.1.1
 – Fixed fatal error

1.1.0
 – Added flag term_name to display term ID as friendly name – Added welcome
page after install

1.0.1
 – Fix. Allow to use object_id=current for users – Small tweaks

1.0.0

 * Initial release.

## Meta

 *  Versiunea **1.3.0**
 *  Ultima actualizare **Acum 2 ani**
 *  Instalări active: **600+**
 *  Versiune WordPress ** 4.1 sau mai recentă **
 *  Testat până la **6.4.8**
 *  Limbă
 * [English (US)](https://wordpress.org/plugins/shortcode-to-display-post-and-user-data/)
 * Etichete
 * [acf](https://ro.wordpress.org/plugins/tags/acf/)[custom fields](https://ro.wordpress.org/plugins/tags/custom-fields/)
   [custom pages](https://ro.wordpress.org/plugins/tags/custom-pages/)[wordpress templates](https://ro.wordpress.org/plugins/tags/wordpress-templates/)
   [wp page templates](https://ro.wordpress.org/plugins/tags/wp-page-templates/)
 *  [Vizualizare avansată](https://ro.wordpress.org/plugins/shortcode-to-display-post-and-user-data/advanced/)

## Evaluări

 5 din 5 stele.

 *  [  8 5 – recenzii (stele)     ](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/reviews/?filter=5)
 *  [  0 4 – recenzii (stele)     ](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/reviews/?filter=4)
 *  [  0 3 – recenzii (stele)     ](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/reviews/?filter=3)
 *  [  0 2 – recenzii (stele)     ](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/reviews/?filter=2)
 *  [  0 1 – recenzii (stele)     ](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/reviews/?filter=1)

[Your review](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/reviews/#new-post)

[Vezi toate recenziile](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/reviews/)

## Contributori

 *   [ Jose Vega ](https://profiles.wordpress.org/josevega/)
 *   [ vegacorp ](https://profiles.wordpress.org/vegacorp/)

## Suport

Ai ceva de zis? Ai nevoie de ajutor?

 [Vezi forumul pentru suport](https://wordpress.org/support/plugin/shortcode-to-display-post-and-user-data/)