ResolvedPHP Warning: Attempt to read property “post_content”
Tagged: Error, Log, PHP Warning, theme
- This topic has 5 replies, 3 voices, and was last updated 2 weeks, 4 days ago by
Alex.
- AuthorPosts
- February 24, 2023 at 4:50 pm #37044
egorp
ParticipantPHP Warning: Attempt to read property “post_content”
I have version 8.0.28 of PHP
The log shows me the following error message constantly
PHP Warning: Attempt to read property "post_content" on null in .../public_html/wp-content/themes/grosso/functions.php on line 1177
The code line 1177 of the file is the following:
<?php elseif(!has_shortcode($post->post_content, 'woocommerce_my_account')): ?>
What can be wrong, how is it corrected?
February 25, 2023 at 12:31 pm #37057Althemist
KeymasterHi egorp,
Sounds like a third-party plugin conflict. The theme itself doesn’t throw such error.
Also, the WP_DEBUG should be always disabled on a production site. This is just a warning, not a real error, so it would not be shown if the WP_DEBUG is disabled.
February 27, 2023 at 8:20 pm #37074egorp
ParticipantThanks for the reply.
Of course, the WP_DEBUG is disabled, the error was displayed by me as an administrator directly from the server log files.
The error message is coming from one of the lines of code in the theme grosso fuctions.php file.
I understand that that’s why I think it could help me to investigate what could be happening, as I indicated in the previous message, this happens in version 8 of PHP, in 7.4 it didn’t.
February 28, 2023 at 11:55 pm #37078egorp
ParticipantAny indication how i could solve it?, the error keeps appearing in the logs…
PHP Warning: Attempt to read property “post_content” on null in …/public_html/wp-content/themes/grosso/functions.php on line 1177
March 12, 2023 at 12:16 pm #37120Althemist
KeymasterHi egorp,
Sorry for the late reply. Our lead developer Alex is investigating the problem. Will let you know asap.
March 13, 2023 at 2:07 pm #37139Alex
KeymasterHi egorp,
I’ve looked on it and couldn’t reproduce the warning. As Dimitar said, most probably the warning is caused by a third party plugin and it will not cause any harm, as it is just warning.
We will add a check on that place and will include it the next update.Thanks,
Alex - AuthorPosts
You must be logged in and have valid license to reply to this topic.