• Resolved Joost

    (@jberculo)


    Hi all,

    I changed my theme so that for logged in users (editor and above) all articles are shown on the front-end of the site. That means the future and pending posts too.

    When I place a comment below a future post all goes well, but when I try to place a comment below a pending post, all I get is a blank page.

    Anyone any clue?

Viewing 1 replies (of 1 total)
  • Thread Starter Joost

    (@jberculo)

    Found the solution.

    In wp-comments-post.php there is the following snippet:

    if ( empty($status->comment_status) ) {
    	do_action('comment_id_not_found', $comment_post_ID);
    	exit;
    } elseif ( !comments_open($comment_post_ID) ) {
    	do_action('comment_closed', $comment_post_ID);
    	wp_die( __('Sorry, comments are closed for this item.') );
    } elseif ( in_array($status->post_status, array('draft', 'pending') ) ) {
    	do_action('comment_on_draft', $comment_post_ID);
    	exit;
    } else {
    	do_action('pre_comment_on_post', $comment_post_ID);
    }

    Just replace
    do_action(‘comment_on_draft’, $comment_post_ID);
    with
    do_action(‘pre_comment_on_post’, $comment_post_ID);

    and remove the exit, and comments will be admitted.

Viewing 1 replies (of 1 total)
  • The topic ‘Commenting on draft posts’ is closed to new replies.