I’m deeply confused by this one: I have a WordPress install on a Media Temple GS [one of many which work fine and are configured almost exactly the same] which is occasionally giving me 404s sitewide. When this happens I get 3 errors together in my PHP error log:
[01-Nov-2013 22:20:50 UTC] PHP Notice: Trying to get property of non-object in /nfs/---/---/mnt/---/domains/---.---/html/wp-includes/post-template.php on line 275
[01-Nov-2013 22:20:50 UTC] PHP Notice: Trying to get property of non-object in /nfs/---/---/mnt/---/domains/---.---/html/wp-includes/post-template.php on line 209
[01-Nov-2013 22:20:50 UTC] PHP Notice: Trying to get property of non-object in /nfs/---/---/mnt/---/domains/---.---/html/wp-includes/post-template.php on line 29
The first two relate to the $post
object & the 3rd to this: get_post()->ID;
Which I think is the creation of the $post
object.
I have two of these identical trios of error messages almost exactly 25 minutes apart [off by 2s].
I’ve tried MT support but they think it must be a WP error. I’m running the latest version of WP but have experienced this problem with earlier versions.
I had 2 plugins enabled: W3 Total Cache & AJAX Thumbnail Rebuild
I’ve tested with and without the cache plugin and the problem persists. I’ve just disabled the thumbnail plug to see if it makes any difference.
Please help this is driving me insane! [and I wanted to publicly launch this site today]
EDIT
I should have also mentioned that I have seen this error on some but not all of the other wordpress installs on this server. I think but cannot be 100% sure, that those showing errors are newer installs than the ones working fine. Though all installs are fully updated.
EDIT2
I’m just working on another WP project and realised at least what those 3 errors mean. I can reproduce exactly those three php errors by going to the index page of a custom post type that does not exist. However this doesn’t explain why that would cause the 404 in this question, especially as it doesn’t just happen only on custom post type index pages. However I think this must be related to custom post types in some way.