Trying to get property of non-object in wp-includes/capabilities.php

Once a minute I get the following notice sequence in debug.log:

[23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1022
[23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1023
[23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1023
[23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1026
[23-Oct-2012 13:27:33 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1026
[23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1022
[23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1023
[23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1023
[23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1026
[23-Oct-2012 13:27:35 UTC] PHP Notice:  Trying to get property of non-object in mysite/wp-includes/capabilities.php on line 1026

I disabled all plugins and selected the default Twenty Eleven theme, but still get it. How can I troubleshoot this? I’m using WordPress 3.4.2.

5 Answers
5

You probably already figured this out, but I just had this issue and figured it out. Hopefully, if anyone runs into this problem, this may help.

My problem came from the Disqus Comment System plugin. Because I had used my Disqus user name to do some test comments on a dev site, when I linked my production site to the dev site, it created comments on test blog posts that didn’t exist.

I had to go into the database and delete the comment rows that were attached to nonexistent post IDs, which fixed the problem for me.

Leave a Comment