format_to_edit

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

WordPress Version: 4.6

/**
 * Acts on text which is about to be edited.
 *
 * The $content is run through esc_textarea(), which uses htmlspecialchars()
 * to convert special characters to HTML entities. If `$richedit` is set to true,
 * it is simply a holder for the {@see 'format_to_edit'} filter.
 *
 * @since 0.71
 * @since 4.4.0 The `$richedit` parameter was renamed to `$rich_text` for clarity.
 *
 * @param string $content   The text about to be edited.
 * @param bool   $rich_text Optional. Whether `$content` should be considered rich text,
 *                          in which case it would not be passed through esc_textarea().
 *                          Default false.
 * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
 */
function format_to_edit($content, $rich_text = false)
{
    /**
     * Filters the text to be formatted for editing.
     *
     * @since 1.2.0
     *
     * @param string $content The text, prior to formatting for editing.
     */
    $content = apply_filters('format_to_edit', $content);
    if (!$rich_text) {
        $content = esc_textarea($content);
    }
    return $content;
}

WordPress Version: 4.4

/**
 * Acts on text which is about to be edited.
 *
 * The $content is run through esc_textarea(), which uses htmlspecialchars()
 * to convert special characters to HTML entities. If $richedit is set to true,
 * it is simply a holder for the 'format_to_edit' filter.
 *
 * @since 0.71
 * @since 4.4.0 The `$richedit` parameter was renamed to `$rich_text` for clarity.
 *
 * @param string $content   The text about to be edited.
 * @param bool   $rich_text Optional. Whether `$content` should be considered rich text,
 *                          in which case it would not be passed through esc_textarea().
 *                          Default false.
 * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
 */
function format_to_edit($content, $rich_text = false)
{
    /**
     * Filter the text to be formatted for editing.
     *
     * @since 1.2.0
     *
     * @param string $content The text, prior to formatting for editing.
     */
    $content = apply_filters('format_to_edit', $content);
    if (!$rich_text) {
        $content = esc_textarea($content);
    }
    return $content;
}

WordPress Version: 4.3

/**
 * Acts on text which is about to be edited.
 *
 * The $content is run through esc_textarea(), which uses htmlspecialchars()
 * to convert special characters to HTML entities. If $richedit is set to true,
 * it is simply a holder for the 'format_to_edit' filter.
 *
 * @since 0.71
 *
 * @param string $content  The text about to be edited.
 * @param bool   $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed).
 * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
 */
function format_to_edit($content, $richedit = false)
{
    /**
     * Filter the text to be formatted for editing.
     *
     * @since 1.2.0
     *
     * @param string $content The text, prior to formatting for editing.
     */
    $content = apply_filters('format_to_edit', $content);
    if (!$richedit) {
        $content = esc_textarea($content);
    }
    return $content;
}

WordPress Version: 3.8

/**
 * Acts on text which is about to be edited.
 *
 * The $content is run through esc_textarea(), which uses htmlspecialchars()
 * to convert special characters to HTML entities. If $richedit is set to true,
 * it is simply a holder for the 'format_to_edit' filter.
 *
 * @since 0.71
 *
 * @param string $content The text about to be edited.
 * @param bool $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed).
 * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
 */
function format_to_edit($content, $richedit = false)
{
    /**
     * Filter the text to be formatted for editing.
     *
     * @since 1.2.0
     *
     * @param string $content The text, prior to formatting for editing.
     */
    $content = apply_filters('format_to_edit', $content);
    if (!$richedit) {
        $content = esc_textarea($content);
    }
    return $content;
}

WordPress Version: 3.7

/**
 * Acts on text which is about to be edited.
 *
 * The $content is run through esc_textarea(), which uses htmlspecialchars()
 * to convert special characters to HTML entities. If $richedit is set to true,
 * it is simply a holder for the 'format_to_edit' filter.
 *
 * @since 0.71
 *
 * @param string $content The text about to be edited.
 * @param bool $richedit Whether the $content should not pass through htmlspecialchars(). Default false (meaning it will be passed).
 * @return string The text after the filter (and possibly htmlspecialchars()) has been run.
 */
function format_to_edit($content, $richedit = false)
{
    $content = apply_filters('format_to_edit', $content);
    if (!$richedit) {
        $content = esc_textarea($content);
    }
    return $content;
}