wppaste
WordPress

Theme_Upgrader_Skin::after()

Since
2.8.0
Source
wp-admin/includes/class-theme-upgrader-skin.php:58
Performs an action following a single theme update.

Compatibility

WordPress
since 2.8.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 Theme_Upgrader_Skin::after() 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
33–165

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

Plugin surface
1 hook

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

Called by
0

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

What it touches

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

Further down the call graph this can also reach cache, serialize, query 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 · 38 distinct outcomes

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

WhenInstructionsCalls it makes
empty($update_actions)33->decrement_update_count(), ->theme_info(), self_admin_url(), __(), apply_filters()
!empty($update_actions)38->decrement_update_count(), ->theme_info(), self_admin_url(), __(), apply_filters(), ->feedback()
!current_user_can() && empty($update_actions)97->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), self_admin_url(), __(), apply_filters()
$stylesheet === false && empty($update_actions)101->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), self_admin_url(), __(), apply_filters()
!current_user_can() && !empty($update_actions)102->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), self_admin_url(), __(), apply_filters(), ->feedback()
!current_user_can() && is_wp_error() && empty($update_actions)103->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), is_wp_error(), self_admin_url(), __(), apply_filters()
!current_user_can() && !is_wp_error() && empty($update_actions)104–106->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters()
$stylesheet === false && !empty($update_actions)106->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet === false && is_wp_error() && empty($update_actions)107->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), is_wp_error(), self_admin_url(), __(), apply_filters()
!current_user_can() && is_wp_error() && !empty($update_actions)108->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), is_wp_error(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet === false && !is_wp_error() && empty($update_actions)108–110->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters()
!current_user_can() && !is_wp_error() && !empty($update_actions)109–111->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters(), ->feedback()
26 further outcomes, up to 165 instructions
$stylesheet === false && is_wp_error() && !empty($update_actions)112->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), is_wp_error(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet === false && !is_wp_error() && !empty($update_actions)113–115->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet === false && current_user_can() && empty($update_actions)124->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), self_admin_url(), __(), apply_filters()
$stylesheet !== false && empty($update_actions)125->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), self_admin_url(), __(), apply_filters()
$stylesheet !== false && empty($update_actions)129->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), self_admin_url(), __(), apply_filters()
$stylesheet === false && current_user_can() && !empty($update_actions)129->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && !empty($update_actions)130->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet === false && current_user_can() && is_wp_error() && empty($update_actions)130->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), is_wp_error(), self_admin_url(), __(), apply_filters()
$stylesheet !== false && is_wp_error() && empty($update_actions)131->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), self_admin_url(), __(), apply_filters()
$stylesheet === false && current_user_can() && !is_wp_error() && empty($update_actions)131–133->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters()
$stylesheet !== false && !is_wp_error() && empty($update_actions)132–134->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters()
$stylesheet !== false && !empty($update_actions)134->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && is_wp_error() && empty($update_actions)135->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), self_admin_url(), __(), apply_filters()
$stylesheet === false && current_user_can() && is_wp_error() && !empty($update_actions)135->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), is_wp_error(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && is_wp_error() && !empty($update_actions)136->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && !is_wp_error() && empty($update_actions)136–138->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters()
$stylesheet === false && current_user_can() && !is_wp_error() && !empty($update_actions)136–138->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && !is_wp_error() && !empty($update_actions)137–139->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && is_wp_error() && !empty($update_actions)140->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && !is_wp_error() && !empty($update_actions)141–143->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && current_user_can() && empty($update_actions)151->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), esc_url(), _x(), _x(), sprintf(), self_admin_url(), __(), apply_filters()
$stylesheet !== false && current_user_can() && !empty($update_actions)156->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), esc_url(), _x(), _x(), sprintf(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && current_user_can() && is_wp_error() && empty($update_actions)157->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), self_admin_url(), __(), apply_filters()
$stylesheet !== false && current_user_can() && !is_wp_error() && empty($update_actions)158–160->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters()
$stylesheet !== false && current_user_can() && is_wp_error() && !empty($update_actions)162->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), self_admin_url(), __(), apply_filters(), ->feedback()
$stylesheet !== false && current_user_can() && !is_wp_error() && !empty($update_actions)163–165->decrement_update_count(), ->theme_info(), ->display(), ->get_template(), urlencode(), urlencode(), admin_url(), activate(), wp_nonce_url(), urlencode(), admin_url(), urlencode(), admin_url(), theme(), get_stylesheet(), current_user_can(), current_user_can(), current_user_can(), esc_url(), __(), __(), sprintf(), esc_url(), _x(), _x(), sprintf(), is_wp_error(), is_network_admin(), self_admin_url(), __(), apply_filters(), ->feedback()

Across PHP versions

PHPCompiledExecutedBranchesNotes
8.6-dev19633–16511
8.519633–16511
8.419633–16511Different branch profile from PHP 8.3
8.319633–16611
8.219633–16611
8.119633–16611
7.419633–16611

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 Theme_Upgrader_Skin::after() runs, in this order:

  1. apply_filters( update_theme_complete_actions )filterline 138 (+80 into the body)

    Filters the list of action links available following a single theme update.

Uses · 14

  • add_query_arg()Retrieves a modified URL query string.
  • admin_url()Retrieves the URL to the admin area for the current site.
  • wp_nonce_url()Retrieves URL with nonce added to URL query.
  • get_stylesheet()Retrieves name of the current stylesheet.
  • current_user_can()Returns whether the current user has the specified capability.
  • esc_url()Checks and cleans a URL.
  • __()Retrieves the translation of $text.
  • _x()Retrieves translated string with gettext context.
  • is_wp_error()Checks whether the given variable is a WordPress Error.
  • is_network_admin()Determines whether the current request is for the network administrative interface.
  • self_admin_url()Retrieves the URL to the admin area for either the current site or the network depending on context.
  • apply_filters()Calls the callback functions that have been added to a filter hook.
Show all 14
  • Theme_Upgrader_Skin::decrement_update_count()
  • Theme_Upgrader_Skin::feedback()

Source code

	public function after() {		$this->decrement_update_count( 'theme' ); 		$update_actions = array();		$theme_info     = $this->upgrader->theme_info();		if ( $theme_info ) {			$name       = $theme_info->display( 'Name' );			$stylesheet = $this->upgrader->result['destination_name'];			$template   = $theme_info->get_template(); 			$activate_link = add_query_arg(				array(					'action'     => 'activate',					'template'   => urlencode( $template ),					'stylesheet' => urlencode( $stylesheet ),				),				admin_url( 'themes.php' )			);			$activate_link = wp_nonce_url( $activate_link, 'switch-theme_' . $stylesheet ); 			$customize_url = add_query_arg(				array(					'theme'  => urlencode( $stylesheet ),					'return' => urlencode( admin_url( 'themes.php' ) ),				),				admin_url( 'customize.php' )			); 			if ( get_stylesheet() === $stylesheet ) {				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {					$update_actions['preview'] = sprintf(						'<a href="%s" class="hide-if-no-customize load-customize">' .						'<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',						esc_url( $customize_url ),						__( 'Customize' ),						/* translators: Hidden accessibility text. %s: Theme name. */						sprintf( __( 'Customize &#8220;%s&#8221;' ), $name )					);				}			} elseif ( current_user_can( 'switch_themes' ) ) {				if ( current_user_can( 'edit_theme_options' ) && current_user_can( 'customize' ) ) {					$update_actions['preview'] = sprintf(						'<a href="%s" class="hide-if-no-customize load-customize">' .						'<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',						esc_url( $customize_url ),						__( 'Live Preview' ),						/* translators: Hidden accessibility text. %s: Theme name. */						sprintf( __( 'Live Preview &#8220;%s&#8221;' ), $name )					);				} 				$update_actions['activate'] = sprintf(					'<a href="%s" class="activatelink">' .					'<span aria-hidden="true">%s</span><span class="screen-reader-text">%s</span></a>',					esc_url( $activate_link ),					_x( 'Activate', 'theme' ),					/* translators: Hidden accessibility text. %s: Theme name. */					sprintf( _x( 'Activate &#8220;%s&#8221;', 'theme' ), $name )				);			} 			if ( ! $this->result || is_wp_error( $this->result ) || is_network_admin() ) {				unset( $update_actions['preview'], $update_actions['activate'] );			}		} 		$update_actions['themes_page'] = sprintf(			'<a href="%s" target="_parent">%s</a>',			self_admin_url( 'themes.php' ),			__( 'Go to Themes page' )		); 		/**		 * Filters the list of action links available following a single theme update.		 *		 * @since 2.8.0		 *		 * @param string[] $update_actions Array of theme action links.		 * @param string   $theme          Theme directory name.		 */

Changelog

Introduced in 2.8.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 6.8.8 tag, from src/wp-admin/includes/class-theme-upgrader-skin.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.