wppaste
WordPress

wp_iframe( callable $content_func, mixed $args )

Since
2.5.0, 5.3.0
Source
wp-admin/includes/media.php:535
Outputs the iframe to display the media upload page.

Parameters

$content_funccallable
Function that outputs the content.
$argsmixed
Optional additional parameters to pass to the callback function when it's called.

Hooks fired · 9

9 hooks fire while wp_iframe() runs, in this order:

  1. do_action( admin_enqueue_scripts )actionline 560 (+25 into the body)

    Fires when enqueuing scripts for all admin pages.

  2. do_action( admin_print_styles-media-upload-popup )actionline 567 (+32 into the body)

    Fires when admin styles enqueued for the legacy (pre-3.5.0) media upload popup are printed.

  3. do_action( admin_print_styles )actionline 570 (+35 into the body)

    Fires when styles are printed for all admin pages.

  4. do_action( admin_print_scripts-media-upload-popup )actionline 577 (+42 into the body)

    Fires when admin scripts enqueued for the legacy (pre-3.5.0) media upload popup are printed.

  5. do_action( admin_print_scripts )actionline 580 (+45 into the body)

    Fires when scripts are printed for all admin pages.

  6. do_action( admin_head-media-upload-popup )actionline 588 (+53 into the body)

    Fires when scripts enqueued for the admin header for the legacy (pre-3.5.0) media upload popup are printed.

  7. do_action( admin_head )actionline 591 (+56 into the body)

    Fires in head section for all admin pages.

  8. do_action( admin_head_{$content_func} )actionline 603 (+68 into the body)

    Fires in the admin header for each specific form tab in the legacy (pre-3.5.0) media upload popup.

  9. do_action( admin_print_footer_scripts )actionline 623 (+88 into the body)

    Prints any scripts and data queued for the footer.

Uses · 9

  • _wp_admin_html_begin()Prints out the beginning of the admin HTML header.
  • bloginfo()Displays information about the current site.
  • _e()Displays translated text.
  • wp_enqueue_style()Enqueues a CSS stylesheet.
  • str_starts_with()Polyfill for `str_starts_with()` function added in PHP 8.0.
  • esc_js()Escapes single quotes, `"`, ``, `&`, and fixes line endings.
  • admin_url()Retrieves the URL to the admin area for the current site.
  • is_rtl()Determines whether the current locale is right-to-left (RTL).
  • do_action()Calls the callback functions that have been added to an action hook.

Used by · 3

Source

function wp_iframe( $content_func, ...$args ) {	global $body_id; 	_wp_admin_html_begin();	?>	<title><?php bloginfo( 'name' ); ?> &rsaquo; <?php _e( 'Uploads' ); ?> &#8212; <?php _e( 'WordPress' ); ?></title>	<?php 	wp_enqueue_style( 'colors' );	// Check callback name for 'media'.	if (		( is_array( $content_func ) && ! empty( $content_func[1] ) && str_starts_with( (string) $content_func[1], 'media' ) ) ||		( ! is_array( $content_func ) && str_starts_with( $content_func, 'media' ) )	) {		wp_enqueue_style( 'deprecated-media' );	} 	?>	<script type="text/javascript">	addLoadEvent = function(func){if(typeof jQuery!=='undefined')jQuery(function(){func();});else if(typeof wpOnload!=='function'){wpOnload=func;}else{var oldonload=wpOnload;wpOnload=function(){oldonload();func();}}};	var ajaxurl = '<?php echo esc_js( admin_url( 'admin-ajax.php', 'relative' ) ); ?>', pagenow = 'media-upload-popup', adminpage = 'media-upload-popup',	isRtl = <?php echo (int) is_rtl(); ?>;	</script>	<?php	/** This action is documented in wp-admin/admin-header.php */	do_action( 'admin_enqueue_scripts', 'media-upload-popup' ); 	/**	 * Fires when admin styles enqueued for the legacy (pre-3.5.0) media upload popup are printed.	 *	 * @since 2.9.0	 */	do_action( 'admin_print_styles-media-upload-popup' );  // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 	/** This action is documented in wp-admin/admin-header.php */	do_action( 'admin_print_styles' ); 	/**	 * Fires when admin scripts enqueued for the legacy (pre-3.5.0) media upload popup are printed.	 *	 * @since 2.9.0	 */	do_action( 'admin_print_scripts-media-upload-popup' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 	/** This action is documented in wp-admin/admin-header.php */	do_action( 'admin_print_scripts' ); 	/**	 * Fires when scripts enqueued for the admin header for the legacy (pre-3.5.0)	 * media upload popup are printed.	 *	 * @since 2.9.0	 */	do_action( 'admin_head-media-upload-popup' ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores 	/** This action is documented in wp-admin/admin-header.php */	do_action( 'admin_head' ); 	if ( is_string( $content_func ) ) {		/**		 * Fires in the admin header for each specific form tab in the legacy		 * (pre-3.5.0) media upload popup.		 *		 * The dynamic portion of the hook name, `$content_func`, refers to the form		 * callback for the media upload type.		 *		 * @since 2.5.0		 */		do_action( "admin_head_{$content_func}" );	} 	$body_id_attr = ''; 	if ( isset( $body_id ) ) {		$body_id_attr = ' id="' . $body_id . '"';	} 	?>	</head>	<body<?php echo $body_id_attr; ?> class="wp-core-ui no-js">

History

Introduced in 2.5.0. Unchanged from 6.7.7 through 7.1.0.

  1. 6.7.7
  2. 6.8.8
  3. 6.9.7
  4. 7.0.4
  5. 7.1.0

Signature, return type and hooks compared across 5 parsed releases.

5.3.0
Formalized the existing and already documented ...$args parameter by adding it to the function signature.from the docblock
2.5.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-admin/includes/media.php, and regenerated for each WordPress release so it tracks the code rather than a snapshot of it.
Corrections
Something wrong on this page? Report it and it gets fixed in the next regeneration.