This plugin will check your posts, comments and other content for broken links and missing images, and notify you if any are found. (non-commercial community fork of broken-link-checker)
10
stars
4
forks
source link
Notice: Trying to get property of non-object in hook_the_content() #33
PHP Notice: Trying to get property of non-object in /var/www/html/wp-content/plugins/broken-link-checker/includes/any-post.php on line 298
please fix
a lot of times this kind of notice can be fixed by isset() or property_exists() , however not sure if that would matter because $post is checked for emptiness first ( http://php.net/manual/en/function.empty.php ) . Maybe post is somehow not an object here.
if ( empty($post) || !in_array($post->post_type, $this->enabled_post_types)) {
Perhaps $post is not empty and $this is unset. That would lead to this condition. More careful checking of the nature of $this may be needed since this could be triggered in an odd place?
entering a debug statement, or var_dump($post) and var_dump($this) might be needed to figure this out.
Also need to know WP and PHP versions in play here.
reported by @johnny538 a few months ago here https://wordpress.org/support/topic/php-errors-135/
a lot of times this kind of notice can be fixed by isset() or property_exists() , however not sure if that would matter because $post is checked for emptiness first ( http://php.net/manual/en/function.empty.php ) . Maybe post is somehow not an object here.
see also https://wordpress.stackexchange.com/questions/88613/notice-trying-to-get-property-of-non-object-in-options-php
looks to me like this
Perhaps $post is not empty and $this is unset. That would lead to this condition. More careful checking of the nature of $this may be needed since this could be triggered in an odd place?