WP_Comment::__get( string $name ): mixed

Magic getter.


Description

If $name matches a post field, the comment post will be loaded and the post’s value returned.


Top ↑

Parameters

$name string Required

Top ↑

Return

mixed


Top ↑

Source

File: wp-includes/class-wp-comment.php. View all references

public function __get( $name ) {
	if ( in_array( $name, $this->post_fields, true ) ) {
		$post = get_post( $this->comment_post_ID );
		return $post->$name;
	}
}


Top ↑

Changelog

Changelog
Version Description
4.4.0 Introduced.

Top ↑

User Contributed Notes

You must log in before being able to contribute a note or feedback.