WordPress.org

Make WordPress Core


Ignore:
Timestamp:
01/26/2016 02:55:15 AM (4 years ago)
Author:
boonebgorges
Message:

Introduce $comment_status and $ping_status params for WP_Query.

Props birgire.
Fixes #35601.

File:
1 edited

Legend:

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

    r36307 r36403  
    14851485     *              search terms, by prepending a hyphen.
    14861486     * @since 4.5.0 Removed the `$comments_popup` parameter.
     1487     *              Introduced the `$comment_status` and `$ping_status` parameters.
    14871488     * @access public
    14881489     *
     
    15011502     *     @type array        $category__not_in        An array of category IDs (NOT in).
    15021503     *     @type string       $category_name           Use category slug (not name, this or any children).
     1504     *     @type string       $comment_status          Comment status.
    15031505     *     @type int          $comments_per_page       The number of comments to return per page.
    15041506     *                                                 Default 'comments_per_page' option.
     
    15461548     *     @type string       $pagename                Page slug.
    15471549     *     @type string       $perm                    Show posts if user has the appropriate capability.
     1550     *     @type string       $ping_status             Ping status.
    15481551     *     @type array        $post__in                An array of post IDs to retrieve, sticky posts will be included
    15491552     *     @type string       $post_mime_type          The mime type of the post. Used for 'attachment' post_type.
     
    30373040        }
    30383041
     3042        if ( ! empty( $q['comment_status'] ) ) {
     3043            $where .= $wpdb->prepare( " AND $wpdb->posts.comment_status = %s ", $q['comment_status'] );
     3044        }
     3045
     3046        if ( ! empty( $q['ping_status'] ) )  {
     3047            $where .= $wpdb->prepare( " AND $wpdb->posts.ping_status = %s ", $q['ping_status'] );
     3048        }
     3049
    30393050        if ( 'any' == $post_type ) {
    30403051            $in_search_post_types = get_post_types( array('exclude_from_search' => false) );
Note: See TracChangeset for help on using the changeset viewer.