Skip to content

Commit

Permalink
better user handling in post transformer
Browse files Browse the repository at this point in the history
  • Loading branch information
pfefferle committed Jan 9, 2024
1 parent 2c107ee commit 6437d3d
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions includes/transformer/class-post.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,19 @@ public function get_url() {
* @return string The User-URL.
*/
protected function get_attributed_to() {
$blog_user = new Blog_User();

if ( is_single_user() ) {
$user = new Blog_User();
return $blog_user->get_url();
}

$user = Users::get_by_id( $this->wp_object->post_author );

if ( $user && ! is_wp_error( $user ) ) {
return $user->get_url();
}

return Users::get_by_id( $this->wp_object->post_author )->get_url();
return $blog_user->get_url();
}

/**
Expand Down

0 comments on commit 6437d3d

Please sign in to comment.