wppaste
WordPress

wp_welcome_panel()

Since
3.3.0, 5.9.0
Source
wp-admin/includes/dashboard.php:2062
Displays a welcome panel to introduce users to WordPress.

Compatibility

WordPress
since 5.9.0
PHP
7.4–8.6-dev
  • 6.7.7
  • 6.8.8
  • 6.9.7
  • 7.0.4
  • 7.1.0

Present in every tracked release (6.7.7 to 7.1.0), and compiles on PHP 7.4 through 8.6-dev.

Performance profile

How much work a call to wp_welcome_panel() does, and what it touches: the algorithmic scaling, the Zend instruction count per call across PHP versions, the hooks it hands control to, and the core code that calls it. Measured from the compiled opcodes, not a stopwatch, so every number is identical on any machine running the same PHP version, and every function in core is ranked by cost.

Cost class
Heavy

Reads or writes the filesystem via file_get_contents().

Scaling
Constant

No loop in the body: the same number of instructions runs whatever you pass in.

Instructions
101–113

Executed per call on PHP 8.5, depending on the branch taken. The body compiles to 154.

Plugin surface
None

Nothing here hands control to plugin code.

Called by
0

Nothing in core calls this; the cost is only what you spend yourself.

What it touches

  • filesystemfilesystem accessfile_get_contents()called directly
  • hookthird-party callbacksapply_filters()one call below wp_welcome_panel()

Further down the call graph this can also reach option, query, cache, serialize and transient. Those are the worst case, several calls deep and usually down an error path, not what a normal call pays.

What one call costs · 6 distinct outcomes

One number would be a lie: the work depends on which branch runs. These are every distinct cost wp_welcome_panel() can have, taken from its control-flow graph on PHP 8.5.

WhenInstructionsCalls it makes
always101wp_get_wp_version(), explode(), current_user_can(), wp_is_block_theme(), file_get_contents(), _e(), admin_url(), esc_url(), __(), esc_html(), printf(), _e(), _e(), admin_url(), esc_url(), _e(), _e(), _e(), _e(), _e(), __(), esc_url(), _e()
always102wp_get_wp_version(), explode(), current_user_can(), wp_is_block_theme(), file_get_contents(), _e(), admin_url(), esc_url(), __(), esc_html(), printf(), _e(), _e(), admin_url(), esc_url(), _e(), _e(), _e(), _e(), _e(), admin_url(), esc_url(), _e()
always110wp_get_wp_version(), explode(), current_user_can(), wp_is_block_theme(), file_get_contents(), _e(), admin_url(), esc_url(), __(), esc_html(), printf(), _e(), _e(), admin_url(), esc_url(), _e(), _e(), _e(), wp_customize_url(), _e(), _e(), _e(), __(), esc_url(), _e()
always111wp_get_wp_version(), explode(), current_user_can(), wp_is_block_theme(), file_get_contents(), _e(), admin_url(), esc_url(), __(), esc_html(), printf(), _e(), _e(), admin_url(), esc_url(), _e(), _e(), _e(), wp_customize_url(), _e(), _e(), _e(), admin_url(), esc_url(), _e()
always112wp_get_wp_version(), explode(), current_user_can(), wp_is_block_theme(), file_get_contents(), _e(), admin_url(), esc_url(), __(), esc_html(), printf(), _e(), _e(), admin_url(), esc_url(), _e(), _e(), _e(), admin_url(), esc_url(), _e(), _e(), _e(), __(), esc_url(), _e()
always113wp_get_wp_version(), explode(), current_user_can(), wp_is_block_theme(), file_get_contents(), _e(), admin_url(), esc_url(), __(), esc_html(), printf(), _e(), _e(), admin_url(), esc_url(), _e(), _e(), _e(), admin_url(), esc_url(), _e(), _e(), _e(), admin_url(), esc_url(), _e()

Across PHP versions

Compiles the same on PHP 7.4, 8.1, 8.2, 8.3, 8.4, 8.5 and 8.6-dev: 154 instructions, 101–113 executed per call, 3 branches. The work does not change between versions.

An instruction is not a fixed amount of time, so a matching count is not necessarily the same speed; what it rules out is a difference in the work itself.

Uses · 9

Source code

function wp_welcome_panel() {	list( $display_version ) = explode( '-', wp_get_wp_version() );	$can_customize           = current_user_can( 'customize' );	$is_block_theme          = wp_is_block_theme();	?>	<div class="welcome-panel-content">	<div class="welcome-panel-header">		<div class="welcome-panel-header-image">			<?php echo file_get_contents( dirname( __DIR__ ) . '/images/dashboard-background.svg' ); ?>		</div>		<h2><?php _e( 'Welcome to WordPress!' ); ?></h2>		<p>			<a href="<?php echo esc_url( admin_url( 'about.php' ) ); ?>">			<?php				/* translators: %s: Current WordPress version. */				printf( __( 'Learn more about the %s version.' ), esc_html( $display_version ) );			?>			</a>		</p>	</div>	<div class="welcome-panel-column-container">		<div class="welcome-panel-column">			<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">				<rect width="48" height="48" rx="4" fill="#1E1E1E"/>				<path fill-rule="evenodd" clip-rule="evenodd" d="M32.0668 17.0854L28.8221 13.9454L18.2008 24.671L16.8983 29.0827L21.4257 27.8309L32.0668 17.0854ZM16 32.75H24V31.25H16V32.75Z" fill="white"/>			</svg>			<div class="welcome-panel-column-content">				<h3><?php _e( 'Author rich content with blocks and patterns' ); ?></h3>				<p><?php _e( 'Block patterns are pre-configured block layouts. Use them to get inspired or create new pages in a flash.' ); ?></p>				<a href="<?php echo esc_url( admin_url( 'post-new.php?post_type=page' ) ); ?>"><?php _e( 'Add a new page' ); ?></a>			</div>		</div>		<div class="welcome-panel-column">			<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">				<rect width="48" height="48" rx="4" fill="#1E1E1E"/>				<path fill-rule="evenodd" clip-rule="evenodd" d="M18 16h12a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H18a2 2 0 0 1-2-2V18a2 2 0 0 1 2-2zm12 1.5H18a.5.5 0 0 0-.5.5v3h13v-3a.5.5 0 0 0-.5-.5zm.5 5H22v8h8a.5.5 0 0 0 .5-.5v-7.5zm-10 0h-3V30a.5.5 0 0 0 .5.5h2.5v-8z" fill="#fff"/>			</svg>			<div class="welcome-panel-column-content">			<?php if ( $is_block_theme ) : ?>				<h3><?php _e( 'Customize your entire site with block themes' ); ?></h3>				<p><?php _e( 'Design everything on your site &#8212; from the header down to the footer, all using blocks and patterns.' ); ?></p>				<a href="<?php echo esc_url( admin_url( 'site-editor.php' ) ); ?>"><?php _e( 'Open site editor' ); ?></a>			<?php else : ?>				<h3><?php _e( 'Start Customizing' ); ?></h3>				<p><?php _e( 'Configure your site&#8217;s logo, header, menus, and more in the Customizer.' ); ?></p>				<?php if ( $can_customize ) : ?>					<a class="load-customize hide-if-no-customize" href="<?php echo wp_customize_url(); ?>"><?php _e( 'Open the Customizer' ); ?></a>				<?php endif; ?>			<?php endif; ?>			</div>		</div>		<div class="welcome-panel-column">			<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true" focusable="false">				<rect width="48" height="48" rx="4" fill="#1E1E1E"/>				<path fill-rule="evenodd" clip-rule="evenodd" d="M31 24a7 7 0 0 1-7 7V17a7 7 0 0 1 7 7zm-7-8a8 8 0 1 1 0 16 8 8 0 0 1 0-16z" fill="#fff"/>			</svg>			<div class="welcome-panel-column-content">			<?php if ( $is_block_theme ) : ?>				<h3><?php _e( 'Switch up your site&#8217;s look & feel with Styles' ); ?></h3>				<p><?php _e( 'Tweak your site, or give it a whole new look! Get creative &#8212; how about a new color palette or font?' ); ?></p>				<a href="<?php echo esc_url( admin_url( '/site-editor.php?path=%2Fwp_global_styles' ) ); ?>"><?php _e( 'Edit styles' ); ?></a>			<?php else : ?>				<h3><?php _e( 'Discover a new way to build your site.' ); ?></h3>				<p><?php _e( 'There is a new kind of WordPress theme, called a block theme, that lets you build the site you&#8217;ve always wanted &#8212; with blocks and styles.' ); ?></p>				<a href="<?php echo esc_url( __( 'https://wordpress.org/documentation/article/block-themes/' ) ); ?>"><?php _e( 'Learn about block themes' ); ?></a>			<?php endif; ?>			</div>		</div>	</div>	</div>	<?php}

Changelog

Introduced in 3.3.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.9.0
Send users to the Site Editor if the active theme is block-based.from the docblock
3.3.0
Introduced.from the docblock

About this page

Parsed data
Generated from the wordpress-develop 6.9.7 tag, from src/wp-admin/includes/dashboard.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.