This commit is contained in:
Hanson.xyz Dev
2026-01-04 17:50:08 -06:00
parent 7e45ce0756
commit acc8ac87a0
4131 changed files with 232562 additions and 250244 deletions
+24 -19
View File
@@ -86,24 +86,31 @@ function the_author( $deprecated = '', $deprecated_echo = true ) {
* Retrieves the author who last edited the current post.
*
* @since 2.8.0
* @since 6.9.0 Added the `$post` parameter. Unknown return value is now explicitly null instead of void.
*
* @return string|void The author's display name, empty string if unknown.
* @param int|WP_Post|null $post Optional. Post ID or post object. Default is global `$post` object.
* @return string|null The author's display name. Empty string if user is unavailable. Null if there was no last editor or the post is invalid.
*/
function get_the_modified_author() {
$last_id = get_post_meta( get_post()->ID, '_edit_last', true );
if ( $last_id ) {
$last_user = get_userdata( $last_id );
/**
* Filters the display name of the author who last edited the current post.
*
* @since 2.8.0
*
* @param string $display_name The author's display name, empty string if unknown.
*/
return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' );
function get_the_modified_author( $post = null ) {
$post = get_post( $post );
if ( ! $post ) {
return null;
}
$last_id = get_post_meta( $post->ID, '_edit_last', true );
if ( ! $last_id ) {
return null;
}
$last_user = get_userdata( $last_id );
/**
* Filters the display name of the author who last edited the current post.
*
* @since 2.8.0
*
* @param string $display_name The author's display name, empty string if user is unavailable.
*/
return apply_filters( 'the_modified_author', $last_user ? $last_user->display_name : '' );
}
/**
@@ -124,13 +131,11 @@ function the_modified_author() {
* Valid values for the `$field` parameter include:
*
* - admin_color
* - aim
* - comment_shortcuts
* - description
* - display_name
* - first_name
* - ID
* - jabber
* - last_name
* - nickname
* - plugins_last_view
@@ -149,9 +154,9 @@ function the_modified_author() {
* - user_registered
* - user_status
* - user_url
* - yim
*
* @since 2.8.0
* @since 6.9.0 Removed `aim`, `jabber`, and `yim` as valid values for the `$field` parameter.
*
* @global WP_User $authordata The current author's data.
*
@@ -286,7 +291,7 @@ function get_the_author_posts() {
if ( ! $post ) {
return 0;
}
return count_user_posts( $post->post_author, $post->post_type );
return (int) count_user_posts( $post->post_author, $post->post_type );
}
/**