wppaste
WordPress

update_right_now_message()

Since
2.5.0
Source
wp-admin/includes/update.php:358
Displays WordPress version and active theme in the 'At a Glance' dashboard widget.

Compatibility

WordPress
since 2.5.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 update_right_now_message() 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
Moderate

Reads stored settings via get_option(), cached per request but not free on a cold cache.

Scaling
Constant

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

Instructions
37–72

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

Plugin surface
1 hook

Third-party callbacks on 'update_right_now_text' run inside this call, and their cost is not bounded by anything here.

Called by
1

1 place in core call this, so the cost is paid more often than your own code shows.

What it touches

  • hookthird-party callbacksapply_filters()called directly
  • optionoption read or writeget_option()one call below update_right_now_message()

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

What one call costs · 8 distinct outcomes

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

WhenInstructionsCalls it makes
!current_user_can()37wp_get_theme(), current_user_can(), __(), apply_filters(), get_bloginfo(), sprintf(), current_user_can()
always42–45wp_get_theme(), current_user_can(), __(), apply_filters(), get_bloginfo(), sprintf(), current_user_can(), get_preferred_from_update_core()
always42wp_get_theme(), current_user_can(), sprintf(), __(), apply_filters(), get_bloginfo(), sprintf(), current_user_can()
current_user_can()47–50wp_get_theme(), current_user_can(), sprintf(), __(), apply_filters(), get_bloginfo(), sprintf(), current_user_can(), get_preferred_from_update_core()
isset($cur) && $cur65wp_get_theme(), current_user_can(), __(), apply_filters(), get_bloginfo(), sprintf(), current_user_can(), get_preferred_from_update_core(), network_admin_url(), __(), sprintf()
isset($cur) && !$cur67wp_get_theme(), current_user_can(), __(), apply_filters(), get_bloginfo(), sprintf(), current_user_can(), get_preferred_from_update_core(), network_admin_url(), __(), __(), sprintf()
current_user_can() && isset($cur) && $cur70wp_get_theme(), current_user_can(), sprintf(), __(), apply_filters(), get_bloginfo(), sprintf(), current_user_can(), get_preferred_from_update_core(), network_admin_url(), __(), sprintf()
current_user_can() && isset($cur) && !$cur72wp_get_theme(), current_user_can(), sprintf(), __(), apply_filters(), get_bloginfo(), sprintf(), current_user_can(), get_preferred_from_update_core(), network_admin_url(), __(), __(), sprintf()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev7337–7151 fewer instruction than PHP 8.5
8.57437–725
8.47437–725
8.37437–725
8.27437–725
8.17437–7251 fewer instruction than PHP 7.4
7.47537–725

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.

Hooks and filters fired · 1

One hook fires while update_right_now_message() runs, in this order:

  1. apply_filters( update_right_now_text )filterline 377 (+19 into the body)

    Filters the text displayed in the 'At a Glance' dashboard widget.

Uses · 7

Used by · 1

Source code

function update_right_now_message() {	$theme_name = wp_get_theme(); 	if ( current_user_can( 'switch_themes' ) ) {		$theme_name = sprintf( '<a href="themes.php">%1$s</a>', $theme_name );	} 	/* translators: 1: Version number, 2: Theme name. */	$content = __( 'WordPress %1$s running %2$s theme.' ); 	/**	 * Filters the text displayed in the 'At a Glance' dashboard widget.	 *	 * Prior to 3.8.0, the widget was named 'Right Now'.	 *	 * @since 4.4.0	 *	 * @param string $content Default text.	 */	$content = apply_filters( 'update_right_now_text', $content ); 	$msg = sprintf( '<span id="wp-version">' . $content . '</span>', get_bloginfo( 'version', 'display' ), $theme_name ); 	if ( current_user_can( 'update_core' ) ) {		$cur = get_preferred_from_update_core(); 		if ( isset( $cur->response ) && 'upgrade' === $cur->response ) {			$msg .= sprintf(				'<a href="%s" class="button" aria-describedby="wp-version">%s</a>',				network_admin_url( 'update-core.php' ),				/* translators: %s: WordPress version number, or 'Latest' string. */				sprintf( __( 'Update to %s' ), $cur->current ? $cur->current : __( 'Latest' ) )			);		}	} 	echo "<p id='wp-version-message'>$msg</p>";}

Changelog

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.

About this page

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