• namliw

    (@namliw)


    Hi guys i got this code

    global $wpdb;
    //echo ”

      “;

    echo “working?”;
    $args = array( ‘suppress_filters’ => false,’author’ => -1);
    $myposts = get_posts( $args );
    foreach ( $myposts as $post ) : echo (current_user_can(‘read’,$post->ID))?1:2; ?>

    • post_name ?>”><?php echo $post->post_title ?>
    • <?php endforeach;
      wp_reset_postdata();

      running on the dashboard page for a suscriber, it works in the front part of wordpress and lists the proper posts however, in the dashboard, get_posts returns an empty array….

      any ideas?

      thx

      – Will

Viewing 1 replies (of 1 total)
  • Thread Starter namliw

    (@namliw)

    global $wpdb;
    	//echo "<ul>";
    
     	echo "working?";
       $args = array( 'suppress_filters' => false,'author' => -1);
       $myposts = get_posts( $args );
    foreach ( $myposts as $post ) : echo (current_user_can('read',$post->ID))?1:2; ?>
    	<li>
    		<a href="<?php echo $post->post_name ?>"><?php echo $post->post_title ?></a>
    	</li>
    <?php endforeach;
    wp_reset_postdata();

    reposted code

Viewing 1 replies (of 1 total)

The topic ‘get_posts not working in dashboard’ is closed to new replies.