I created a custom post type
tickets, than I added few tickets in it. But with the following code, I tried to show list of tickets submitted by the current user and its not working for me.
global $post, $paged, $current_user; get_currentuserinfo(); if(empty($paged)) $paged = 1; $args = array( 'post_type' => 'tickets', 'post_author' => $current_user->ID, 'paged'=> $paged ); $myposts = get_posts( $args ); foreach( $myposts as $post ) : setup_postdata($post); echo "test echo"; // testing purpose echo "<tr><td>".the_title()."</td><td>".the_excerpt()."</td><td>".$post->post_status."</td></tr>"; endforeach; wp_reset_postdata();
And its showing empty results in the table. I am not sure about similar questions. But this is my code. so please dont vote it down, if you think its not a right question. i need solution for my issues, i am breaking my head more than one hour.
Thank you for all of your comments, actually I found solution myself. Sometimes, we may not think a small thing can cause certain unexpected results. The problem is simple. the current user has few pending tickets. The important thing , here, if we didn't specify the
post_status. It will assign default
publish. So it didn't get results.