I was wondering if there was a way I could hook into $post-> comment_status directly as well
I doubt that you can hook into the $post->comment_status way of doing things, simply because it’s not a function call, its an instance property. It’s theoretically possible to execute code from magic methods in PHP 5 (using php’s __get
and __set
) but that’s not how it’s implemented. $post
is an instance of stdClass
, created using $post = new stdClass;
I believe.
See https://www.php.net/manual/en/language.oop5.overloading.php for more information.