get_comment_to_edit

The timeline below displays how wordpress function get_comment_to_edit has changed across different WordPress versions. If a version is not listed, refer to the next available version below.

WordPress Version: 5.5

/**
 * Returns a WP_Comment object based on comment ID.
 *
 * @since 2.0.0
 *
 * @param int $id ID of comment to retrieve.
 * @return WP_Comment|false Comment if found. False on failure.
 */
function get_comment_to_edit($id)
{
    $comment = get_comment($id);
    if (!$comment) {
        return false;
    }
    $comment->comment_ID = (int) $comment->comment_ID;
    $comment->comment_post_ID = (int) $comment->comment_post_ID;
    $comment->comment_content = format_to_edit($comment->comment_content);
    /**
     * Filters the comment content before editing.
     *
     * @since 2.0.0
     *
     * @param string $comment_content Comment content.
     */
    $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
    $comment->comment_author = format_to_edit($comment->comment_author);
    $comment->comment_author_email = format_to_edit($comment->comment_author_email);
    $comment->comment_author_url = format_to_edit($comment->comment_author_url);
    $comment->comment_author_url = esc_url($comment->comment_author_url);
    return $comment;
}

WordPress Version: 5.3

/**
 * Returns a WP_Comment object based on comment ID.
 *
 * @since 2.0.0
 *
 * @param int $id ID of comment to retrieve.
 * @return WP_Comment|false Comment if found. False on failure.
 */
function get_comment_to_edit($id)
{
    $comment = get_comment($id);
    if (!$comment) {
        return false;
    }
    $comment->comment_ID = (int) $comment->comment_ID;
    $comment->comment_post_ID = (int) $comment->comment_post_ID;
    $comment->comment_content = format_to_edit($comment->comment_content);
    /**
     * Filters the comment content before editing.
     *
     * @since 2.0.0
     *
     * @param string $comment->comment_content Comment content.
     */
    $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
    $comment->comment_author = format_to_edit($comment->comment_author);
    $comment->comment_author_email = format_to_edit($comment->comment_author_email);
    $comment->comment_author_url = format_to_edit($comment->comment_author_url);
    $comment->comment_author_url = esc_url($comment->comment_author_url);
    return $comment;
}

WordPress Version: 4.6

/**
 * Returns a WP_Comment object based on comment ID.
 *
 * @since 2.0.0
 *
 * @param int $id ID of comment to retrieve.
 * @return WP_Comment|false Comment if found. False on failure.
 */
function get_comment_to_edit($id)
{
    if (!$comment = get_comment($id)) {
        return false;
    }
    $comment->comment_ID = (int) $comment->comment_ID;
    $comment->comment_post_ID = (int) $comment->comment_post_ID;
    $comment->comment_content = format_to_edit($comment->comment_content);
    /**
     * Filters the comment content before editing.
     *
     * @since 2.0.0
     *
     * @param string $comment->comment_content Comment content.
     */
    $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
    $comment->comment_author = format_to_edit($comment->comment_author);
    $comment->comment_author_email = format_to_edit($comment->comment_author_email);
    $comment->comment_author_url = format_to_edit($comment->comment_author_url);
    $comment->comment_author_url = esc_url($comment->comment_author_url);
    return $comment;
}

WordPress Version: 4.4

/**
 * Returns a WP_Comment object based on comment ID.
 *
 * @since 2.0.0
 *
 * @param int $id ID of comment to retrieve.
 * @return WP_Comment|false Comment if found. False on failure.
 */
function get_comment_to_edit($id)
{
    if (!$comment = get_comment($id)) {
        return false;
    }
    $comment->comment_ID = (int) $comment->comment_ID;
    $comment->comment_post_ID = (int) $comment->comment_post_ID;
    $comment->comment_content = format_to_edit($comment->comment_content);
    /**
     * Filter the comment content before editing.
     *
     * @since 2.0.0
     *
     * @param string $comment->comment_content Comment content.
     */
    $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
    $comment->comment_author = format_to_edit($comment->comment_author);
    $comment->comment_author_email = format_to_edit($comment->comment_author_email);
    $comment->comment_author_url = format_to_edit($comment->comment_author_url);
    $comment->comment_author_url = esc_url($comment->comment_author_url);
    return $comment;
}

WordPress Version: 4.3

/**
 * Returns a comment object based on comment ID.
 *
 * @since 2.0.0
 *
 * @param int $id ID of comment to retrieve.
 * @return object|false Comment if found. False on failure.
 */
function get_comment_to_edit($id)
{
    if (!$comment = get_comment($id)) {
        return false;
    }
    $comment->comment_ID = (int) $comment->comment_ID;
    $comment->comment_post_ID = (int) $comment->comment_post_ID;
    $comment->comment_content = format_to_edit($comment->comment_content);
    /**
     * Filter the comment content before editing.
     *
     * @since 2.0.0
     *
     * @param string $comment->comment_content Comment content.
     */
    $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
    $comment->comment_author = format_to_edit($comment->comment_author);
    $comment->comment_author_email = format_to_edit($comment->comment_author_email);
    $comment->comment_author_url = format_to_edit($comment->comment_author_url);
    $comment->comment_author_url = esc_url($comment->comment_author_url);
    return $comment;
}

WordPress Version: 3.7

/**
 * Returns a comment object based on comment ID.
 *
 * @since 2.0.0
 *
 * @param int $id ID of comment to retrieve.
 * @return bool|object Comment if found. False on failure.
 */
function get_comment_to_edit($id)
{
    if (!$comment = get_comment($id)) {
        return false;
    }
    $comment->comment_ID = (int) $comment->comment_ID;
    $comment->comment_post_ID = (int) $comment->comment_post_ID;
    $comment->comment_content = format_to_edit($comment->comment_content);
    /**
     * Filter the comment content before editing.
     *
     * @since 2.0.0
     *
     * @param string $comment->comment_content Comment content.
     */
    $comment->comment_content = apply_filters('comment_edit_pre', $comment->comment_content);
    $comment->comment_author = format_to_edit($comment->comment_author);
    $comment->comment_author_email = format_to_edit($comment->comment_author_email);
    $comment->comment_author_url = format_to_edit($comment->comment_author_url);
    $comment->comment_author_url = esc_url($comment->comment_author_url);
    return $comment;
}