Skip to content

Commit 6437d3d

Browse files
committed
better user handling in post transformer
1 parent 2c107ee commit 6437d3d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

includes/transformer/class-post.php

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,19 @@ public function get_url() {
116116
* @return string The User-URL.
117117
*/
118118
protected function get_attributed_to() {
119+
$blog_user = new Blog_User();
120+
119121
if ( is_single_user() ) {
120-
$user = new Blog_User();
122+
return $blog_user->get_url();
123+
}
124+
125+
$user = Users::get_by_id( $this->wp_object->post_author );
126+
127+
if ( $user && ! is_wp_error( $user ) ) {
121128
return $user->get_url();
122129
}
123130

124-
return Users::get_by_id( $this->wp_object->post_author )->get_url();
131+
return $blog_user->get_url();
125132
}
126133

127134
/**

0 commit comments

Comments
 (0)