wp_untrash_comment

Definition:
function wp_untrash_comment($comment_id) {}

Removes a comment from the Trash

Parameters

  • int $comment_id: Comment ID.

Return values

returns:False on failure

Defined actions

  • untrash_comment
    do_action('untrash_comment', $comment_id);
  • untrashed_comment
    do_action('untrashed_comment', $comment_id);

Source code

function wp_untrash_comment($comment_id) {

	if ( ! (int)$comment_id )

		return false;



	do_action('untrash_comment', $comment_id);



	$status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true);

	if ( empty($status) )

		$status = '0';



	if ( wp_set_comment_status($comment_id, $status) ) {

		delete_comment_meta($comment_id, '_wp_trash_meta_time');

		delete_comment_meta($comment_id, '_wp_trash_meta_status');

		do_action('untrashed_comment', $comment_id);

		return true;

	}



	return false;

}

4205

About these ads

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

Join 184 other followers

%d bloggers like this: