media_send_to_editor() WordPress Function

The media_send_to_editor() function is used to send images and other media files to the WordPress editor. This function can be used to insert media into posts and pages, or to add media to the media library.

media_send_to_editor( string $html ) #

Adds image HTML to editor.


Parameters

$html

(string)(Required)


Top ↑

Source

File: wp-admin/includes/media.php

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;
}


Top ↑

Changelog

Changelog
VersionDescription
2.5.0Introduced.

The content displayed on this page has been created in part by processing WordPress source code files which are made available under the GPLv2 (or a later version) license by theĀ Free Software Foundation. In addition to this, the content includes user-written examples and information. All material is subject to review and curation by the WPPaste.com community.

Show More
Show More