User meta shortcodes

Contributors: Richard Vencu

Tags: user, user-meta, shortcode

Requires at least: 2.7

Tested up to: 3.5

Stable tag: 0.3.1

Use user meta as shortcode in post content without edit your theme files.

== Description ==


use {userinfo field="fieldname"} or {authorinfo field="fieldname"} shortcodes in your post content to show the „fieldname” meta value from the user-meta for the current logged-in user or for the post author without editing your theme files.


{userinfo field="last_name"}

returns the last name of the current logged-in user. If no user is logged in then the value is empty string

List of some of the available meta field names: ID, user_login, user_pass, user_nicename, user_email, user_url, user_registered, display_name, first_name, last_name, nickname, description, user_level, admin_color (Theme of your admin page. Default is fresh.), closedpostboxes_page, nickname, primary_blog, rich_editing, source_domain

{authorinfo field="last_name"}

returns the last name of the current post/page author.

{authorinfo field="ID"}

returns the user ID of the current post/page author.

List of some of the available meta field names: user_login, user_pass, user_nicename, user_email, user_url, user_registered, user_activation_key, user_status, display_name, nickname, first_name, last_name, description, jabber, aim, yim, user_level, user_firstname, user_lastname, user_description, rich_editing, comment_shortcuts, admin_color, plugins_per_page, plugins_last_view, ID

If you add custom user meta via additional plugins, then the meta should be available for the above shortcodes

== Installation ==

0. Download the plugin here: User-meta-shortcodes
1. Upload `user-meta-shortcodes` folder to the `/wp-content/plugins/` directory

2. Activate the plugin through the ‘Plugins’ menu in WordPress

== Screenshots ==

not applicable

== Frequently Asked Questions ==

Q. Can I use another user besides current user or post author?

A. It would be added in future versions of the plugin

33 comentarii

  1. Shawn
    Shawn 18/01/2011 la 15:39 |

    It would be nice to have a option to disable the span tag that is also returned. I would like to use this plugin to fill in a custom contact form, but the span tag gets inserted into the value attribute.

  2. Jon
    Jon 08/11/2011 la 17:56 |

    hi …

    Do you know if there is any way to perform conditional checks on the userinfo returned by the shortcode ?

    [userinfo field=”English” if=”true”]you speak english[/userinfo]
    [userinfo field=”English” if=”false”]you don’t speak english[/userinfo]

    or something like that ?

    Thanks 🙂

  3. Maryke
    Maryke 03/02/2012 la 12:24 |


    I would just like to add the following:

    Hi [firstname]

    Is there an easy way?

  4. Tassos
    Tassos 27/06/2012 la 03:24 |


    I love the plugin. I have one question though whcih hope you can help. I have added extra fields on the user profile to display images. When I use the shortcodes tehy display the url to the images rather than the images themselves. Is there a way to make it do display the image rather than the URL?
    I am using the following plugin to add the fields
    Thank you in advance and for this little great plugin 🙂

  5. Paddy
    Paddy 07/09/2012 la 14:53 |

    great plugin, thanks a lot for developing.

    I have a problem (I think is realted to the span issue in the first comment)

    I am trying to use a shortcode in a URL in my post to link a user to their content.

    For example field=”user_login”]

    However this will not render right. It looks like the span tag is cuasing an issue from what I can see.

    I tried your code above in the functions.php file but it brought down the site, would not load.

    Any suggestions on how to get this shortcode to work within the URL?

    Thanks in advance

  6. Rudd
    Rudd 20/01/2013 la 06:33 |

    Why not include the parameter to show user gravatar?
    I’m pretty sure it’ll be useful. My quick search on google showed that currently there’s no plugin or shortocode to show gravatar for login users.

  7. carine
    carine 23/03/2013 la 20:32 |

    I currently use user meta to create a user registration form front for members; Now I would like to display in front all users and their data by retrieving shorcodes as a kind of address book, do you think it’s possible?


  8. Jan Viljoen
    Jan Viljoen 25/03/2013 la 21:13 |

    I have deployed your WordPress plugin, User meta shortcodes, as an integral part of an ambitious project, which I presently coordinates. A project, which I dubbed, encouraging the re-evoking of self-organizing networks and supportive systems within modern societies. I would love to acknowledge and recognize your contribution to the present success of the project.

    Will you please send me an email address, where I could send an explanation email, which outline and provide more details on the what, how and why of the project and the implication of your involvement by recognition.

    Many thanks


  9. Benutzerprofil - Erweitern - Verwenden | iNetProjekt

    […] kommt bei mir das PlugIn “User meta shortcodes” zum Einsatz. Eine Beschreibung: User meta shortcodes – [01.08.2012] Seite war/ist Offline: Ein […]

  10. Stu Farrimond
    Stu Farrimond 14/12/2013 la 13:04 |

    Just wanted to say that in response to your comment that you ‘aren’t proud’ of this plugin, I think it is a great plugin. Extremely useful. I would be proud of it! Can’t wait for more of your plugins!

  11. ibis
    ibis 31/12/2013 la 21:04 |

    Is the anyway to remove the need quotation marks from the shortcode.

    for example instead of [userinfo field=”user_email”] use [userinfo field=user_email]

    The quote marks tend to break links when trying to use the users data for sending data to other areas of the site… for example.

    in my profile page i have some link that i want to use like subcribe to my newsletters

    as you can see, having the quotes will break the link.

    basically im trying to keep my mebers from having to retype their info on the phplist form when the click on the link to subscribe. its no big deal to have to retype their own info, but why make them do it when i already have their info and can just prepopulate it for them uing a baic POST/GET call.

    MAURIZIO 08/05/2014 la 01:00 |

    hi Rihard
    would be possible to get a complete list of the meta field names and what additional plugins to add?
    I also retrieve the address and some fields added with „user Cimy extra field”

  13. Paco
    Paco 06/08/2014 la 17:54 |

    Hi! I love your plugin. ONe question… is possible to add this short code in the email? I mean.. am using Contact Form 7 and i would like to send the first name and last name from the database in the email contact form 7. Do you think is possible? Thank in advance.

  14. Nicolai
    Nicolai 13/08/2014 la 14:08 |

    Great plugin!
    Is there anyway i can change how the user_registered tag is displayed?
    Now its

    2013-01-13 21:10

    Could i make it just go

    13-01-2013 ?

    Best regards

  15. Paul
    Paul 29/08/2014 la 21:23 |

    Richard I just had to leave you a comment to say this plugin is the best user meta shortcode plugin out there! I have played around with a few different plugins, free and premium, and hands down yours beats them all!

    I had been looking for a plugin which just works, straight out of the box, without having to make any tweaks/edits. Most of the plugins I tried were OK, but they were very bloated or needed multiple steps to achieve the simplest of little things. Or they had problems and would not work well inside of the other plugins I was using.

    With your plugin, I just looked at the sample shortcodes on the wordpress page and it was good to go! Worked like a charm!

    Thank you for making a brilliant plugin and giving it away for free! Wishing you and your family all the best! God bless!

  16. matthew
    matthew 17/01/2015 la 07:51 |

    Notice: Undefined variable: default in /www/wdc2015/wp-content/plugins/user-meta-shortcodes/user-meta-shortcodes.php on line 103

    I’m finding the plugin very useful, but I’m getting an error. it’s almost 1 am my time been working for 16 hours I can no longer read code. Can you please help?

  17. Nick
    Nick 02/03/2015 la 23:26 |

    I love the concept of this plugin, it is exactly what I am looking for.

    I am having trouble getting the shortcode to display the data I am asking for. I am testing [userinfo field=”last_name”]{{empty}}[/userinfo] and it outputs . There is a valid Last Name that I have verified in the database. Currently I am the admin and sole user. Is me being an admin an issue?

    Obviously the plugin works for many people, I must be missing something on my end.

    I am using WP 4.1.1


  18. colin
    colin 21/09/2015 la 20:43 |

    This plugin is fantastic. Is there any way to return an „otheruser” by their email instead of „login”? (if so, then this perfect!)
    [otheruserinfo field=”avatar” email=””]


Lăsați un comentariu