WP_Comment::__get()publicWP 4.4.0

Magic getter.

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

Метод класса: WP_Comment{}

Хуков нет.

Возвращает

Разное.

Использование

$WP_Comment = new WP_Comment();
$WP_Comment->__get( $name );
$name(строка) (обязательный)
Property name.

Список изменений

С версии 4.4.0 Введена.

Код WP_Comment::__get() WP 6.5.2

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