Browser: Chrome 110 OS: macOS / Windows / Linux / etc.
Hi all,
When on php 8, 8.1 everytime the 404 page is triggered I get this error log: Attempt to read property “post_title” on null in public_html/wp-content/themes/bricks/includes/conditions.php on line 412
Found the problem!
It was a condition in the global Footer template:
Had a section above the footer that I wanted to show only on specific pages…
If I remove the condition , there is no more error.
Is this the right way of achieving this condition? @timmse
First of all, it is a PHP notice, not an error.
The reason why the notice is issued is that $post->post_title is not available in the 404 template, and PHP>7.x treats this differently.
You can work around this problem by not using the post title in the condition, but e.g. the post_url and the WordPress functions is_front_page() and is_404() (if you want to show the section on the 404 page/template too).