Changeset 28362
- Timestamp:
- 05/11/2014 12:25:29 AM (11 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/author-template.php
r28265 r28362 207 207 */ 208 208 function get_the_author_posts() { 209 return count_user_posts( get_post()->post_author ); 209 $post = get_post(); 210 if ( ! $post ) { 211 return 0; 212 } 213 return count_user_posts( $post->post_author ); 210 214 } 211 215 -
trunk/tests/phpunit/tests/user/author.php
r25002 r28362 76 76 $this->assertEquals( '', get_the_author_meta( 'does_not_exist' ) ); 77 77 } 78 79 function test_get_the_author_posts() { 80 // Test with no global post, result should be 0 because no author is found 81 $this->assertEquals( 0, get_the_author_posts() ); 82 $GLOBALS['post'] = $this->post_id; 83 $this->assertEquals( 1, get_the_author_posts() ); 84 } 78 85 }
Note: See TracChangeset
for help on using the changeset viewer.