From 7809335e8af0aa02724e717c79b0c8e725a13396 Mon Sep 17 00:00:00 2001 From: Derrick Hammer Date: Wed, 20 Jul 2016 14:18:19 -0400 Subject: [PATCH] *If post is empty, return $display_name --- inc/User.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/inc/User.php b/inc/User.php index ee276f2a..a7fa5ce3 100644 --- a/inc/User.php +++ b/inc/User.php @@ -149,6 +149,9 @@ function dwqa_is_followed( $post_id = false, $user_id = false ) { function dwqa_the_author( $display_name ) { global $post; + if ( empty( $post ) ) { + return $display_name; + } if ( 'dwqa-answer' == $post->post_type || 'dwqa-question' == $post->post_type) { if ( dwqa_is_anonymous( $post->ID ) ) { $anonymous_name = get_post_meta( $post->ID, '_dwqa_anonymous_name', true ); @@ -283,4 +286,4 @@ function follow_question() { } } -?> \ No newline at end of file +?>