@@ -115,7 +115,11 @@ public function __construct( $attributes, $content = null ) {
115
115
} elseif ( $ post ) {
116
116
$ attributes ['id ' ] = $ post ->ID ;
117
117
$ post_author = get_userdata ( $ post ->post_author );
118
- $ default_to .= $ post_author ->user_email ;
118
+ if ( is_a ( $ post_author , '\WP_User ' ) ) {
119
+ $ default_to .= $ post_author ->user_email ;
120
+ } else {
121
+ $ default_to .= get_option ( 'admin_email ' );
122
+ }
119
123
}
120
124
121
125
if ( ! empty ( self ::$ forms ) ) {
@@ -534,7 +538,8 @@ public static function get_compiled_form( $feedback_id, $form ) {
534
538
}
535
539
} else {
536
540
// The feedback content is stored as the first "half" of post_content
537
- $ value = is_a ( $ feedback , '\WP_Post ' ) ? $ feedback ->post_content : '' ;
541
+ $ value = ( is_object ( $ feedback ) && is_a ( $ feedback , '\WP_Post ' ) ) ?
542
+ $ feedback ->post_content : '' ;
538
543
list ( $ value ) = explode ( '<!--more--> ' , $ value );
539
544
$ value = trim ( $ value );
540
545
}
@@ -627,7 +632,8 @@ public static function get_compiled_form_for_email( $feedback_id, $form ) {
627
632
}
628
633
} else {
629
634
// The feedback content is stored as the first "half" of post_content
630
- $ value = is_a ( $ feedback , '\WP_Post ' ) ? $ feedback ->post_content : '' ;
635
+ $ value = ( is_object ( $ feedback ) && is_a ( $ feedback , '\WP_Post ' ) ) ?
636
+ $ feedback ->post_content : '' ;
631
637
list ( $ value ) = explode ( '<!--more--> ' , $ value );
632
638
$ value = trim ( $ value );
633
639
}
0 commit comments