Title: Display Posts by Username using Shortcode
Last modified: December 9, 2024

---

# Display Posts by Username using Shortcode

 *  Resolved [trey96](https://wordpress.org/support/users/trey96/)
 * (@trey96)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/display-posts-by-username-using-shortcode/)
 * Hi,
 * I am currently using the following shortcode to display all posts on my site:
 * [the-post-grid id=”617″ ]
 * However, I would like to sow posts for a specific user. How do I use the same
   or similar shortcode to enter the exact username of a user? For example, something
   like the following:
 * Username is JohnDoe
 * [the-post-grid id=”617″ user=”JohnDoe”]
 * My guess is that some PHP code might be involved. Please help me find a solution.
   I would greatly appreciate a speedy response. Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

 *  Plugin Support [Habib](https://wordpress.org/support/users/habibjh/)
 * (@habibjh)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/display-posts-by-username-using-shortcode/#post-18186410)
 * It’s a dynamic shortcode so any manual paramater doesn’t work for the [the-post-
   grid] shortcode. If you would like to pull posts by user you need to choose a
   user from the query builder of the shortcode otherwise it doesn’t work.
 * You can easily pick a user from this settings – [https://prnt.sc/n1wR2Eq_PE5r](https://prnt.sc/n1wR2Eq_PE5r)
 * Thank you 🙂
    -  This reply was modified 1 year, 5 months ago by [Habib](https://wordpress.org/support/users/habibjh/).
 *  Thread Starter [trey96](https://wordpress.org/support/users/trey96/)
 * (@trey96)
 * [1 year, 5 months ago](https://wordpress.org/support/topic/display-posts-by-username-using-shortcode/#post-18186469)
 * Hi [@habibjh](https://wordpress.org/support/users/habibjh/)
 * I appreciate the quick reply. The trouble with using the query builder is that
   I would have to manually select a user each time a new person registers on my
   site. I have a setup where I dynamically swap out the usernames, but I would 
   need a shortcode to do it. I suppose I would need a custom shortcode coupled 
   with PHP code to add to my functions.php file. Can you put that PHP code together
   for me, along with a custom shortcode? Thank you in advance.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Display Posts by Username using Shortcode’ is closed to new replies.

 * ![](https://ps.w.org/the-post-grid/assets/icon-256x256.gif?rev=2647621)
 * [The Post Grid – Shortcode, Gutenberg Blocks and Elementor Addon for Post Grid](https://wordpress.org/plugins/the-post-grid/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/the-post-grid/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/the-post-grid/)
 * [Active Topics](https://wordpress.org/support/plugin/the-post-grid/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/the-post-grid/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/the-post-grid/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [user](https://wordpress.org/support/topic-tag/user/)

 * 2 replies
 * 2 participants
 * Last reply from: [trey96](https://wordpress.org/support/users/trey96/)
 * Last activity: [1 year, 5 months ago](https://wordpress.org/support/topic/display-posts-by-username-using-shortcode/#post-18186469)
 * Status: resolved