Cross-reference `WP_Comment_Query::query()` as the location for finding information on default arguments for `WP_Comment_Query`.

Also updates the return types on `get_comments()` and `get_approved_comments()`, as an integer can also be returned if the `$count` argument is true.

Fixes #30111.

Built from https://develop.svn.wordpress.org/trunk@30281


git-svn-id: http://core.svn.wordpress.org/trunk@30281 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Drew Jaynes 2014-11-08 20:35:22 +00:00
parent 35e509b0c8
commit e7b465046a
3 changed files with 10 additions and 9 deletions

View File

@ -131,9 +131,10 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
* @since 4.1.0 Refactored to leverage {@see WP_Comment_Query} over a direct query. * @since 4.1.0 Refactored to leverage {@see WP_Comment_Query} over a direct query.
* *
* @param int $post_id The ID of the post. * @param int $post_id The ID of the post.
* @param array $args Optional. See {@see WP_Comment_Query} for information * @param array $args Optional. See {@see WP_Comment_Query::query()} for information
* on accepted arguments. * on accepted arguments.
* @return array $comments The approved comments. * @return int|array $comments The approved comments, or number of comments if `$count`
* argument is true.
*/ */
function get_approved_comments( $post_id = 0, $args = array() ) { function get_approved_comments( $post_id = 0, $args = array() ) {
$defaults = array( $defaults = array(
@ -211,15 +212,13 @@ function get_comment(&$comment, $output = OBJECT) {
* *
* The comment list can be for the blog as a whole or for an individual post. * The comment list can be for the blog as a whole or for an individual post.
* *
* The list of comment arguments are 'status', 'orderby', 'comment_date_gmt',
* 'order', 'number', 'offset', and 'post_id'.
*
* @since 2.7.0 * @since 2.7.0
* *
* @global wpdb $wpdb WordPress database abstraction object. * @global wpdb $wpdb WordPress database abstraction object.
* *
* @param mixed $args Optional. Array or string of options to override defaults. * @param string|array $args Optional. Array or string of arguments. See {@see WP_Comment_Query::query()}
* @return array List of comments. * for information on accepted arguments. Default empty.
* @return int|array List of comments or number of found comments if `$count` argument is true.
*/ */
function get_comments( $args = '' ) { function get_comments( $args = '' ) {
$query = new WP_Comment_Query; $query = new WP_Comment_Query;
@ -229,6 +228,8 @@ function get_comments( $args = '' ) {
/** /**
* WordPress Comment Query class. * WordPress Comment Query class.
* *
* See {@see WP_Comment_Query::query()} for accepted arguments.
*
* @since 3.1.0 * @since 3.1.0
*/ */
class WP_Comment_Query { class WP_Comment_Query {

View File

@ -849,7 +849,7 @@ class WP_Widget_Recent_Comments extends WP_Widget {
* *
* @since 3.4.0 * @since 3.4.0
* *
* @see get_comments() * @see WP_Comment_Query::query() for information on accepted arguments.
* *
* @param array $comment_args An array of arguments used to retrieve the recent comments. * @param array $comment_args An array of arguments used to retrieve the recent comments.
*/ */

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.1-alpha-30280'; $wp_version = '4.1-alpha-30281';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.