Title: comments for draft posts
Last modified: August 22, 2016

---

# comments for draft posts

 *  Resolved [OrbiTorbi](https://wordpress.org/support/users/orbitorbi/)
 * (@orbitorbi)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/)
 * Hey guys,
 * im looking for a way to allow comments on draft post (at the backend).
    The reason
   is that my customer need a way to comment draft posts for other people in the
   company. Is there a special hook or filter?
 * The only solutions i found was editing the core file (in my opinion very bad 
   idea)
 * Any ideas?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/#post-5803594)
 * The ‘comment_on_draft’ action fires just before the script exits, essentially
   ignoring the comment POST. You can’t stop the exit, but you should be able to
   add a comment from the action callback by compiling the data in `$_POST` and 
   then calling `wp_new_comment()`.
 *  Thread Starter [OrbiTorbi](https://wordpress.org/support/users/orbitorbi/)
 * (@orbitorbi)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/#post-5803638)
 * Hello bcworkz,
 * unfortunately the hook ‘comment_on_draft’ never fires.
 * The reason is, the function ‘wp_ajax_replyto_comment’ dies with: ‘ERROR: you 
   are replying to a comment on a draft post.’ before the hook fires.
 *     ```
       global $wp_list_table;
       	if ( empty( $action ) )
       		$action = 'replyto-comment';
   
       	check_ajax_referer( $action, '_ajax_nonce-replyto-comment' );
   
       	$comment_post_ID = (int) $_POST['comment_post_ID'];
       	$post = get_post( $comment_post_ID );
       	if ( ! $post )
       		wp_die( -1 );
   
       	if ( !current_user_can( 'edit_post', $comment_post_ID ) )
       		wp_die( -1 );
   
       	if ( empty( $post->post_status ) )
       		wp_die( 1 );
       	elseif ( in_array($post->post_status, array('draft', 'pending', 'trash') ) )
       		wp_die( __('ERROR: you are replying to a comment on a draft post.') );
       ```
   
 * Is there any way to setup a hook before ‘wp_ajax_replyto_comment’ fires for example
   to override $post->post_status?
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/#post-5803660)
 * Hmmm, it does fire on my installation when adding a comment from the draft preview
   page. At least when the commenter is logged in, I didn’t test further.
 * From where are you trying to add a comment? I’m not seeing any other option besides
   adding from the preview page.
 *  Thread Starter [OrbiTorbi](https://wordpress.org/support/users/orbitorbi/)
 * (@orbitorbi)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/#post-5803662)
 * I have add the comment metabox at the functions.php for draft posts.
 * Now i want to add a comment from wp-admin/post.php?post=postID&action=edit.
    
   I can see the metabox and existing comments but i can’t add new comments.
 * WordPress dies each time on this position
 *     ```
       elseif ( in_array($post->post_status, array('draft', 'pending', 'trash') ) )
       		wp_die( __('ERROR: you are replying to a comment on a draft post.') );
       ```
   
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/#post-5803690)
 * I’m afraid there’s no hook to intervene in that situation. What you could do 
   is use javascript to change the ‘action’ hidden field (if that’s where the ‘replyto-
   comment’ is coming from) to something else. This will cause the AJAX request 
   to be channeled to a callback function of your choosing, where you can save the
   comment regardless of post status.
 * The action value could also be part of the AJAX event handler, in which case 
   you’d have to override the event handler itself. Another option would be to insert
   a completely custom meta box so everything is handled the way you want it.
 * Or just add comments from the preview page and use the hook I originally suggested.
 *  Thread Starter [OrbiTorbi](https://wordpress.org/support/users/orbitorbi/)
 * (@orbitorbi)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/#post-5803706)
 * You are right, it’s a pity that there is no hook.
 * I’m trying your suggestion and post my solution here.
 *  Thread Starter [OrbiTorbi](https://wordpress.org/support/users/orbitorbi/)
 * (@orbitorbi)
 * [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/#post-5803745)
 * I have tried to manipulate the hidden fields with javascript but it doesn’t work.
   
   But what works is to regist a new post status for example “draft_comment”.
 * Mybe it is not the right way but it works for my project.
    I hope in the future
   there is a hook to handle this case.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘comments for draft posts’ is closed to new replies.

## Tags

 * [Comments](https://wordpress.org/support/topic-tag/comments/)
 * [draft-posts](https://wordpress.org/support/topic-tag/draft-posts/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 7 replies
 * 2 participants
 * Last reply from: [OrbiTorbi](https://wordpress.org/support/users/orbitorbi/)
 * Last activity: [11 years, 1 month ago](https://wordpress.org/support/topic/comments-for-draft-posts/#post-5803745)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
