Changeset 36403
- Timestamp:
- 01/26/2016 02:55:15 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/query.php
r36307 r36403 1485 1485 * search terms, by prepending a hyphen. 1486 1486 * @since 4.5.0 Removed the `$comments_popup` parameter. 1487 * Introduced the `$comment_status` and `$ping_status` parameters. 1487 1488 * @access public 1488 1489 * … … 1501 1502 * @type array $category__not_in An array of category IDs (NOT in). 1502 1503 * @type string $category_name Use category slug (not name, this or any children). 1504 * @type string $comment_status Comment status. 1503 1505 * @type int $comments_per_page The number of comments to return per page. 1504 1506 * Default 'comments_per_page' option. … … 1546 1548 * @type string $pagename Page slug. 1547 1549 * @type string $perm Show posts if user has the appropriate capability. 1550 * @type string $ping_status Ping status. 1548 1551 * @type array $post__in An array of post IDs to retrieve, sticky posts will be included 1549 1552 * @type string $post_mime_type The mime type of the post. Used for 'attachment' post_type. … … 3037 3040 } 3038 3041 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 3039 3050 if ( 'any' == $post_type ) { 3040 3051 $in_search_post_types = get_post_types( array('exclude_from_search' => false) ); -
trunk/tests/phpunit/tests/query.php
r35242 r36403 493 493 $this->assertContains( 'LIMIT 5, 5', $q->request ); 494 494 } 495 496 /** 497 * @ticket 35601 498 */ 499 public function test_comment_status() { 500 $p1 = self::factory()->post->create( array( 'comment_status' => 'open' ) ); 501 $p2 = self::factory()->post->create( array( 'comment_status' => 'closed' ) ); 502 503 $q = new WP_Query( array( 504 'fields' => 'ids', 505 'comment_status' => 'closed', 506 ) ); 507 508 $this->assertSame( array( $p2 ), $q->posts ); 509 } 510 511 /** 512 * @ticket 35601 513 */ 514 public function test_ping_status() { 515 $p1 = self::factory()->post->create( array( 'ping_status' => 'open' ) ); 516 $p2 = self::factory()->post->create( array( 'ping_status' => 'closed' ) ); 517 518 $q = new WP_Query( array( 519 'fields' => 'ids', 520 'ping_status' => 'closed', 521 ) ); 522 523 $this->assertSame( array( $p2 ), $q->posts ); 524 } 495 525 }
Note: See TracChangeset
for help on using the changeset viewer.