Forums
Forums / Fixing WordPress / comments_open FUNCTION
(@nemoxp)
13 years, 8 months ago
Hello. I believe this function is missing something… Wouldn’t be good a check on $_post or $post_id ?
function comments_open( $post_id = null ) { if($post_id ){ $_post = get_post($post_id); if($_post){ $open = ( 'open' == $_post->comment_status ); return apply_filters( 'comments_open', $open, $post_id ); } } }
I say this because i get a strange error when calling comments_open() with no parameter:
Notice: Trying to get property of non-object in /home/hutanuro/public_html/catalin/wp-includes/comment-template.php on line 776
The topic ‘comments_open FUNCTION’ is closed to new replies.
(@nemoxp)
13 years, 8 months ago
Hello.
I believe this function is missing something…
Wouldn’t be good a check on $_post or $post_id ?
I say this because i get a strange error when calling comments_open() with no parameter: