wpseek.com
WordPress开发者和主题制作者的搜索引擎
get_approved_comments › WordPress Function
Since2.0.0
已弃用n/a
› get_approved_comments ( $post_id, $args = array() )
参数: (2) |
|
返回: |
|
定义在: |
|
文档: | |
Change Log: |
|
Retrieves the approved comments for a post.
Related Functions: get_comments, have_comments, get_pending_comments_num, get_page_of_comment, get_comment
源码
function get_approved_comments( $post_id, $args = array() ) { if ( ! $post_id ) { return array(); } $defaults = array( 'status' => 1, 'post_id' => $post_id, 'order' => 'ASC', ); $parsed_args = wp_parse_args( $args, $defaults ); $query = new WP_Comment_Query(); return $query->query( $parsed_args ); }