Title: dynamic shortcode not working
Last modified: January 15, 2021

---

# dynamic shortcode not working

 *  Resolved [hamishstrachan](https://wordpress.org/support/users/hamishstrachan/)
 * (@hamishstrachan)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/dynamic-shortcode-not-working-3/)
 * I am trying to add a dynamic shortode using:
    `echo do_shortcode('[user_profile_avatar
   user_id="<?php $user->id ?>" size="original" align="aligncenter" link="image"
   target="_blank"]'. $user->display_name .'[/user_profile_avatar]');`
 * but it is not working.
 * I have tested that $user-id is returning the correct user ID, but I just get 
   a default image.

The topic ‘dynamic shortcode not working’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/wp-user-profile-avatar_c4dced.svg)
 * [WP User Profile Avatar](https://wordpress.org/plugins/wp-user-profile-avatar/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wp-user-profile-avatar/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wp-user-profile-avatar/)
 * [Active Topics](https://wordpress.org/support/plugin/wp-user-profile-avatar/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wp-user-profile-avatar/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wp-user-profile-avatar/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [hamishstrachan](https://wordpress.org/support/users/hamishstrachan/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/dynamic-shortcode-not-working-3/)
 * Status: resolved