Trying to get property ‘permalink’ of non-object (meta-tags-context.php)
-
In our Staging environment, the error log is accumulating many PHP notices from wordpress-seo/src/context/meta-tags-context.php, which say:
PHP Notice: Trying to get property 'permalink' of non-object in /home/[...]/wp-content/plugins/wordpress-seo/src/context/meta-tags-context.php on line 308
This is in function
generate_site_url()
, and is caused by the variable$home_page_indexable
being set to booleanfalse
rather than an object.The code has been through several layers, including
indexable_repository->find_for_home_page()
andupgrade_indexable()
. This last function has calledbuilder->build()
, which has returned false, and that is what has generated the error log entry back inmeta-tags-context.php
.Looking into this, I think it’s because this is a non-production environment, where reindexing is disabled.
Please change the
generate_site_url()
function, so that it handles the situation where$home_page_indexable
isfalse
.
- You must be logged in to reply to this topic.