Title: Get post for current user only&#8230; error!!!
Last modified: September 27, 2021

---

# Get post for current user only… error!!!

 *  Resolved [redair](https://wordpress.org/support/users/redair/)
 * (@redair)
 * [4 years, 8 months ago](https://wordpress.org/support/topic/get-post-for-current-user-only-error/)
 * Hi.
 * This code does not work any longer, any idea?
 *     ```
       <?php global $current_user; wp_get_current_user(); ?>
       <?php if ( is_user_logged_in() ) {
           $getUsername = $current_user->user_login;
           echo do_shortcode('[ninja_tables id="Table ID Here"  filter=" ' . $getUsername . '" ] ');
       }
       ?>
       ```
   

Viewing 1 replies (of 1 total)

 *  Plugin Support [Syed Numan](https://wordpress.org/support/users/annuman/)
 * (@annuman)
 * [4 years, 7 months ago](https://wordpress.org/support/topic/get-post-for-current-user-only-error/#post-15046981)
 * Hello [@redair](https://wordpress.org/support/users/redair/),
 * It should have worked and I have tested it and worked as expected in my case.
   So, please assign the table ID properly. You should use this snippet in a Code
   Snippet plugin that provides a shortcode and use that shortcode on the page.
 * Thanks

Viewing 1 replies (of 1 total)

The topic ‘Get post for current user only… error!!!’ is closed to new replies.

 * ![](https://ps.w.org/ninja-tables/assets/icon-256x256.png?rev=3337819)
 * [Ninja Tables – Easy Data Table Builder](https://wordpress.org/plugins/ninja-tables/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/ninja-tables/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/ninja-tables/)
 * [Active Topics](https://wordpress.org/support/plugin/ninja-tables/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/ninja-tables/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/ninja-tables/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Syed Numan](https://wordpress.org/support/users/annuman/)
 * Last activity: [4 years, 7 months ago](https://wordpress.org/support/topic/get-post-for-current-user-only-error/#post-15046981)
 * Status: resolved