Changeset 30098 for trunk/src/wp-includes/comment.php
- Timestamp:
- 10/29/2014 09:57:07 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/comment.php
r30096 r30098 129 129 * 130 130 * @since 2.0.0 131 * @uses $wpdb 132 * 133 * @param int $post_id The ID of the post 134 * @return array $comments The approved comments 135 */ 136 function get_approved_comments($post_id) { 137 global $wpdb; 138 return $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post_id)); 131 * 132 * @param int $post_id The ID of the post. 133 * @param array $args Optional. WP_Comment_Query args. 134 * @return array $comments The approved comments. 135 */ 136 function get_approved_comments( $post_id = 0, $args = array() ) { 137 $defaults = array( 138 'status' => 1, 139 'post_id' => $post_id, 140 'order' => 'ASC', 141 ); 142 $r = wp_parse_args( $args, $defaults ); 143 144 $query = new WP_Comment_Query; 145 return $query->query( $r ); 139 146 } 140 147
Note: See TracChangeset
for help on using the changeset viewer.