Current user post data fetch in WordPress

Current-user-post-data-fetch-in-wordpress

This code for you are using for login using all posts get on your page. this code working. you can try this code.

<?php
$count=1;
$current_author = get_query_var('author');
$author_posts=  get_posts( 'author='.get_current_user_id().'&posts_per_page=-1' );
echo "<pre>";
print_r ($author_posts);
echo "</pre>";
echo $author_post['post_author'];
if($author_posts){
 foreach ($author_posts as $author_post)  {
 ?>
  <tr>
   <td><?=$count?></td>
   <td><?=the_post_thumbnail(get_the_ID())?></td>            
   <td><?php echo '<a href="'.get_permalink($author_post->ID).'">'.$author_post->post_title.'</a>';?></td>
   <td>100</td>
   <td>100</td>
   <td class="profile-view-btn"><?php echo '<a href="'.get_permalink($author_post->ID).'">'?>View<?'</a>';?></td>
  </tr>
 <?php
  $count++;
 }

}?>
Learn Tutorials Point
We Well organized and easy-to-understand Interactive tutorials With lots of examples of how to use Tutorials WordPress, PHP, Bootstrap, Bootstrap 4, HTML, CSS, AJAX, jQuery, Woocommerce, Post, Database, Javascript, Theme, Responsive, Templates.

Leave a Reply

Your email address will not be published. Required fields are marked *

Contact us

Fill in the form below or give us a call and we'll contact you. We endeavour to answer all enquiries within 24 hours on business days.