media_send_to_editor

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

WordPress Version: 5.5

/**
 * Adds image HTML to editor.
 *
 * @since 2.5.0
 *
 * @param string $html
 */
function media_send_to_editor($html)
{
    ?>
	<script type="text/javascript">
	var win = window.dialogArguments || opener || parent || top;
	win.send_to_editor( <?php 
    echo wp_json_encode($html);
    ?> );
	</script>
	<?php 
    exit;
}

WordPress Version: 5.3

/**
 * Adds image html to editor
 *
 * @since 2.5.0
 *
 * @param string $html
 */
function media_send_to_editor($html)
{
    ?>
	<script type="text/javascript">
	var win = window.dialogArguments || opener || parent || top;
	win.send_to_editor( <?php 
    echo wp_json_encode($html);
    ?> );
	</script>
	<?php 
    exit;
}

WordPress Version: 5.1

/**
 * Adds image html to editor
 *
 * @since 2.5.0
 *
 * @param string $html
 */
function media_send_to_editor($html)
{
    ?>
<script type="text/javascript">
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor( <?php 
    echo wp_json_encode($html);
    ?> );
</script>
	<?php 
    exit;
}

WordPress Version: 4.4

/**
 * Adds image html to editor
 *
 * @since 2.5.0
 *
 * @param string $html
 */
function media_send_to_editor($html)
{
    ?>
<script type="text/javascript">
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor( <?php 
    echo wp_json_encode($html);
    ?> );
</script>
<?php 
    exit;
}

WordPress Version: 4.2

/**
 * Adds image html to editor
 *
 * @since 2.5.0
 *
 * @param string $html
 */
function media_send_to_editor($html)
{
    ?>
<script type="text/javascript">
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor('<?php 
    echo addslashes($html);
    ?>');
</script>
<?php 
    exit;
}

WordPress Version: 3.7

/**
 * Adds image html to editor
 *
 * @since 2.5.0
 *
 * @param string $html
 */
function media_send_to_editor($html)
{
    ?>
<script type="text/javascript">
/* <![CDATA[ */
var win = window.dialogArguments || opener || parent || top;
win.send_to_editor('<?php 
    echo addslashes($html);
    ?>');
/* ]]> */
</script>
<?php 
    exit;
}