WP_Comment::__isset() WordPress Method

The __isset() method for WP_Comment objects is used to check if a given property exists for a given comment. If the property exists, the method returns true. If the property does not exist, the method returns false.

WP_Comment::__isset( string $name ) #

Check whether a non-public property is set.


Description

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


Top ↑

Parameters

$name

(string)(Required)Property name.


Top ↑

Return

(bool)


Top ↑

Source

File: wp-includes/class-wp-comment.php

	public function __isset( $name ) {
		if ( in_array( $name, $this->post_fields, true ) && 0 !== (int) $this->comment_post_ID ) {
			$post = get_post( $this->comment_post_ID );
			return property_exists( $post, $name );
		}
	}


Top ↑

Changelog

Changelog
VersionDescription
4.4.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.