Trying to get property ‘comment_status’ of non-object
-
The plugin throw following error:
PHP Notice: Trying to get property ‘comment_status’ of non-object in /Users/robinferrari/Documents/web/Perso/auberceaudor/.www/wp-includes/comment-template.php on line 1244
This is due to hwwa_css_comments_wordpress function
instead doing
if(comments_open)
it should be
if ( function_exists('comments_open') && function_exists('get_post') && get_post() && comments_open() ) {
Here is a patch function to place in theme or plugin:
function patch_hwwa_css_comments_wordpress() { if ( function_exists('comments_open') && function_exists('get_post') && get_post() && comments_open() ) { ?> <style type="text/css"> .hwwa_field { display: none !important; } </style> <?php } } remove_action( 'wp_head', 'hwwa_css_comments_wordpress'); add_action('wp_head', 'patch_hwwa_css_comments_wordpress');
- The topic ‘Trying to get property ‘comment_status’ of non-object’ is closed to new replies.