purevtsooj

Wordpress Custom Query

Aug 29th, 2016
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.27 KB | None | 0 0
  1. global $wpdb;
  2. $posts = $wpdb->get_results( $wpdb->prepare("SELECT comment_ID, comment_author, comment_date FROM {$wpdb->comments}") );
  3. foreach ( $posts as $item ) {
  4.     echo $item->comment_author;
  5. }
  6.  
  7. // https://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query
Advertisement
Add Comment
Please, Sign In to add comment