diff --git a/wp-includes/class-wp-comment.php b/wp-includes/class-wp-comment.php index ab6bf14b55..d6336937e2 100644 --- a/wp-includes/class-wp-comment.php +++ b/wp-includes/class-wp-comment.php @@ -320,4 +320,43 @@ final class WP_Comment { return false; } + + /** + * Whether a comment has post from which to retrieve magic properties + * + * @since 4.4.0 + * @access public + * + * @param string $name + * @return bool + */ + public function __isset( $name ) { + if ( + 0 === (int) $this->comment_post_ID + || property_exists( $this, $name ) + ) { + return; + } + + $post = get_post( $this->comment_post_ID ); + if ( $post ) { + return property_exists( $post, $name ); + } + } + + /** + * Magic getter for $post properties + * + * @since 4.4.0 + * @access public + * + * @param string $name + * @return mixed + */ + public function __get( $name ) { + $post = get_post( $this->comment_post_ID ); + if ( $post ) { + return $post->$name; + } + } } diff --git a/wp-includes/version.php b/wp-includes/version.php index 7e398de2c7..f7216eba3d 100644 --- a/wp-includes/version.php +++ b/wp-includes/version.php @@ -4,7 +4,7 @@ * * @global string $wp_version */ -$wp_version = '4.4-alpha-34582'; +$wp_version = '4.4-alpha-34583'; /** * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.