Changeset 32524
- Timestamp:
- 05/21/2015 07:48:19 PM (10 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/post.php
r32523 r32524 5327 5327 * 5328 5328 * @since 2.2.0 5329 * 5330 * @param string|array $post_type Array or comma-separated string of post types.5331 * 5329 * @since 4.3.0 Added the ability to pass an array to `$post_type`. 5330 * 5331 * @param string|array $post_type Single post type or an array of post types. Currently only supports 'post' or 'page'. 5332 5332 * @return string SQL code that can be added to a where clause. 5333 5333 */ … … 5340 5340 * 5341 5341 * @since 3.0.0 5342 * @since 4.3.0 Introduced the ability to pass multiplepost types to `$post_type`.5342 * @since 4.3.0 Introduced the ability to pass an array of post types to `$post_type`. 5343 5343 * 5344 5344 * @see get_private_posts_cap_sql() 5345 5345 * 5346 * @param array|string $post_type Array or comma-separated list of post type(s).5346 * @param array|string $post_type Single post type or an array of post types. 5347 5347 * @param bool $full Optional. Returns a full WHERE statement instead of just 5348 5348 * an 'andalso' term. Default true. … … 5358 5358 $post_types = $post_type; 5359 5359 } else { 5360 $post_types = preg_split( '/[\s,]+/',$post_type );5360 $post_types = array( $post_type ); 5361 5361 } 5362 5362 -
trunk/src/wp-includes/user.php
r32523 r32524 252 252 * @since 3.0.0 253 253 * @since 4.1.0 Added `$post_type` argument. 254 * @since 4.3.0 Added `$public_only` argument. 254 * @since 4.3.0 Added `$public_only` argument. Added the ability to pass an array of post types to `$post_type`. 255 255 * 256 256 * @global wpdb $wpdb WordPress database object for queries. … … 289 289 * 290 290 * @param array $users Array of user IDs. 291 * @param string|array $post_type Optional. Array or comma-separated listof post types to check. Defaults to 'post'.291 * @param string|array $post_type Optional. Single post type or array of post types to check. Defaults to 'post'. 292 292 * @param bool $public_only Optional. Only return counts for public posts. Defaults to false. 293 293 * @return array Amount of posts each user has written. -
trunk/tests/phpunit/tests/post/getPostsByAuthorSql.php
r32523 r32524 25 25 register_post_type( 'bar' ); 26 26 27 $maybe_string = get_posts_by_author_sql( 'foo,bar');27 $maybe_string = get_posts_by_author_sql( array( 'foo', 'bar' ) ); 28 28 $this->assertContains( "post_type = 'foo'", $maybe_string ); 29 29 $this->assertContains( "post_type = 'bar'", $maybe_string ); … … 136 136 wp_set_current_user( $u ); 137 137 138 $maybe_string = get_posts_by_author_sql( 'foo,bar,baz');138 $maybe_string = get_posts_by_author_sql( array( 'foo', 'bar', 'baz' ) ); 139 139 $this->assertNotContains( "post_type = 'foo' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string ); 140 140 $this->assertNotContains( "post_type = 'bar' AND ( post_status = 'publish' OR post_status = 'private' )", $maybe_string );
Note: See TracChangeset
for help on using the changeset viewer.