Make WordPress Core


Ignore:
Timestamp:
01/09/2016 04:43:33 AM (9 years ago)
Author:
boonebgorges
Message:

Introduce comments_template_query_args filter.

This new filter gives developers a way to target the arguments used for comment
queries specifically when populating the main comment template.

Props birgire.
Fixes #34442.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-includes/comment-template.php

    r36226 r36235  
    13381338    }
    13391339
     1340    /**
     1341     * Filters the arguments used to query comments in comments_template().
     1342     *
     1343     * @since 4.5.0
     1344     *
     1345     * @param array $comment_args {
     1346     *     Array of arguments. See WP_Comment_Query::__construct() for detailed descriptions.
     1347     *
     1348     *     @type string|array $orderby                   Field(s) to order by.
     1349     *     @type string       $order                     Order of results. Accepts 'ASC' or 'DESC'.
     1350     *     @type string       $status                    Comment status.
     1351     *     @type int          $post_id                   ID of the post.
     1352     *     @type bool         $no_found_rows             Whether to refrain from querying for found rows.
     1353     *     @type bool         $update_comment_meta_cache Whether to prime cache for comment meta.
     1354     *     @type bool|string  $hierarchical              Whether to query for comments hierarchically.
     1355     *     @type int          $offset                    Comment offset.
     1356     *     @type int          $number                    Number of comments to fetch.
     1357     * }
     1358     */
     1359    $comment_args = apply_filters( 'comments_template_query_args', $comment_args );
    13401360    $comment_query = new WP_Comment_Query( $comment_args );
    13411361    $_comments = $comment_query->comments;
Note: See TracChangeset for help on using the changeset viewer.