WP_Comment::__isset
Determines whether a non-public property is set.
If $name matches a post field, the comment post will be loaded and the post's value checked.
Метод класса: WP_Comment{}
Хуков нет.
Возвращает
bool. Whether the property is set.
Использование
$WP_Comment = new WP_Comment(); $WP_Comment->__isset( $name );
- $name(строка) (обязательный)
- Property to check if set.
Список изменений
| С версии 4.4.0 | Введена. |
| С версии 7.1.0 | Returns false instead of causing a fatal error when the comment's post cannot be found. |
Код WP_Comment::__isset() WP Comment:: isset WP 7.1
public function __isset( $name ) {
if ( in_array( $name, $this->post_fields, true ) && 0 !== (int) $this->comment_post_ID ) {
$post = get_post( (int) $this->comment_post_ID );
return $post && property_exists( $post, $name );
}
return false;
}