WP_Comment::__get
Magic getter.
If $name matches a post field, the comment post will be loaded and the post's value returned.
Method of the class: WP_Comment{}
No Hooks.
Returns
Mixed.
Usage
$WP_Comment = new WP_Comment(); $WP_Comment->__get( $name );
- $name(string) (required)
- Property name.
Changelog
| Since 4.4.0 | Introduced. |
WP_Comment::__get() WP Comment:: get code WP 7.0
public function __get( $name ) {
if ( in_array( $name, $this->post_fields, true ) ) {
$post = get_post( $this->comment_post_ID );
return $post->$name;
}
}