Changeset 55755
- Timestamp:
- 05/14/2023 05:56:26 PM (17 months ago)
- Location:
- trunk
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/author-template.php
r55444 r55755 15 15 * 16 16 * @since 1.5.0 17 * @since 6.3.0 Returns an empty string if the author's display name is unknown. 17 18 * 18 19 * @global WP_User $authordata The current author's data. 19 20 * 20 21 * @param string $deprecated Deprecated. 21 * @return string |null The author's display name.22 * @return string The author's display name, empty string if unknown. 22 23 */ 23 24 function get_the_author( $deprecated = '' ) { … … 33 34 * @since 2.9.0 34 35 * 35 * @param string |null$display_name The author's display name.36 */ 37 return apply_filters( 'the_author', is_object( $authordata ) ? $authordata->display_name : null);36 * @param string $display_name The author's display name. 37 */ 38 return apply_filters( 'the_author', is_object( $authordata ) ? $authordata->display_name : '' ); 38 39 } 39 40 … … 56 57 * @param string $deprecated Deprecated. 57 58 * @param bool $deprecated_echo Deprecated. Use get_the_author(). Echo the string or return it. 58 * @return string |nullThe author's display name, from get_the_author().59 * @return string The author's display name, from get_the_author(). 59 60 */ 60 61 function the_author( $deprecated = '', $deprecated_echo = true ) { … … 220 221 * Retrieves either author's link or author's name. 221 222 * 222 * If the author has a home page set, return an HTML link, otherwise just return the223 * author's name.223 * If the author has a home page set, return an HTML link, otherwise just return 224 * the author's name. 224 225 * 225 226 * @since 3.0.0 … … 227 228 * @global WP_User $authordata The current author's data. 228 229 * 229 * @return string |null An HTML link if the author's url existin user meta,230 * else the result of get_the_author().230 * @return string An HTML link if the author's URL exists in user meta, 231 * otherwise the result of get_the_author(). 231 232 */ 232 233 function get_the_author_link() { … … 308 309 * @global WP_User $authordata The current author's data. 309 310 * 310 * @return string An HTML link to the author page, or an empty string if $authordata is n't defined.311 * @return string An HTML link to the author page, or an empty string if $authordata is not set. 311 312 */ 312 313 function get_the_author_posts_link() { 313 314 global $authordata; 315 314 316 if ( ! is_object( $authordata ) ) { 315 317 return ''; -
trunk/tests/phpunit/tests/user/getTheAuthor.php
r55754 r55755 46 46 $this->assertSame( 'Test Author', $author_name ); 47 47 } 48 49 /** 50 * @ticket 58157 51 */ 52 public function test_get_the_author_should_return_empty_string_if_authordata_is_not_set() { 53 unset( $GLOBALS['authordata'] ); 54 55 $this->assertSame( '', get_the_author() ); 56 } 48 57 } -
trunk/tests/phpunit/tests/user/getTheAuthorMeta.php
r55754 r55755 62 62 } 63 63 64 public function test_get_the_author_meta_no_authordata() { 64 /** 65 * @ticket 20529 66 * @ticket 58157 67 */ 68 public function test_get_the_author_meta_should_return_empty_string_if_authordata_is_not_set() { 65 69 unset( $GLOBALS['authordata'] ); 66 70 -
trunk/tests/phpunit/tests/user/getTheAuthorPostsLink.php
r55754 r55755 80 80 unset( $GLOBALS['authordata'] ); 81 81 } 82 83 /** 84 * @ticket 58157 85 */ 86 public function test_get_the_author_posts_link_should_return_empty_string_if_authordata_is_not_set() { 87 unset( $GLOBALS['authordata'] ); 88 89 $this->assertSame( '', get_the_author_posts_link() ); 90 } 82 91 }
Note: See TracChangeset
for help on using the changeset viewer.