I'm getting the following error in my
PHP Notice: Trying to get property of non-object in /my-wesbite/wp-content/themes/express/header.php on line 36
This is line 36 of
header.php in my theme:
<body id="page-<?php echo $post->post_name;?>" <?php body_class(); ?> data-site-url="<?php echo site_url(); ?>">
wp_head() is called before line 36.
I have looked at the output source of every page of the website and
My assumption is the error is related to
$post->post_name, because it is talking about an object's property. Am I needing to declare
global $post first or something else?
debug.log I can't tell if this error fires on every page or just on certain ones.
As a sidenote, I'm planning on adjusting the
id to account for taxonomies as well, but I can get that sorted out once I figure out what is causing this error.
Thank you for any help you can offer.