Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Notice: Trying to get property of non-object in hook_the_content() #33

Open
HongPong opened this issue Mar 13, 2019 · 0 comments
Open

Comments

@HongPong
Copy link
Owner

HongPong commented Mar 13, 2019

reported by @johnny538 a few months ago here
https://wordpress.org/support/topic/php-errors-135/

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.

see also https://wordpress.stackexchange.com/questions/88613/notice-trying-to-get-property-of-non-object-in-options-php

looks to me like this

        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.
@HongPong HongPong changed the title Notice: Trying to get property of non-object Notice: Trying to get property of non-object in hook_the_content() Mar 13, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant