upgrader_process_complete
Action HookDescription
Upgrades several themes at once. Default true. } / public function bulk_upgrade( $themes, $args = array() ) { $wp_version = wp_get_wp_version(); $defaults = array( 'clear_update_cache' => true, ); $parsed_args = wp_parse_args( $args, $defaults ); $this->init(); $this->bulk = true; $this->upgrade_strings(); $current = get_site_transient( 'update_themes' ); add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 ); add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 ); add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 ); $this->skin->header(); // Connect to the filesystem first. $res = $this->fs_connect( array( WP_CONTENT_DIR ) ); if ( ! $res ) { $this->skin->footer(); return false; } $this->skin->bulk_header(); /* Only start maintenance mode if: - running Multisite and there are one or more themes specified, OR - a theme with an update available is currently in use.Hook Information
File Location |
wp-admin/includes/class-theme-upgrader.php
View on GitHub
|
Hook Type | Action |
Line Number | 510 |
Hook Parameters
Type | Name | Description |
---|---|---|
string[]
|
$themes
|
Array of the theme slugs. |
array
|
$args
|
{ Optional. Other arguments for upgrading several themes at once. Default empty array. |
Usage Examples
Basic Usage
<?php
// Hook into upgrader_process_complete
add_action('upgrader_process_complete', 'my_custom_function', 10, 2);
function my_custom_function($themes, $args) {
// Your custom code here
}
Source Code Context
wp-admin/includes/class-theme-upgrader.php:510
- How this hook is used in WordPress core
<?php
505
506 // Refresh the Theme Update information.
507 wp_clean_themes_cache( $parsed_args['clear_update_cache'] );
508
509 /** This action is documented in wp-admin/includes/class-wp-upgrader.php */
510 do_action(
511 'upgrader_process_complete',
512 $this,
513 array(
514 'action' => 'update',
515 'type' => 'theme',
PHP Documentation
<?php
/**
* Upgrades several themes at once.
*
* @since 3.0.0
* @since 3.7.0 The `$args` parameter was added, making clearing the update cache optional.
*
* @param string[] $themes Array of the theme slugs.
* @param array $args {
* Optional. Other arguments for upgrading several themes at once. Default empty array.
*
* @type bool $clear_update_cache Whether to clear the update cache if successful.
* Default true.
* }
* @return array[]|false An array of results, or false if unable to connect to the filesystem.
*/
public function bulk_upgrade( $themes, $args = array() ) {
$wp_version = wp_get_wp_version();
$defaults = array(
'clear_update_cache' => true,
);
$parsed_args = wp_parse_args( $args, $defaults );
$this->init();
$this->bulk = true;
$this->upgrade_strings();
$current = get_site_transient( 'update_themes' );
add_filter( 'upgrader_pre_install', array( $this, 'current_before' ), 10, 2 );
add_filter( 'upgrader_post_install', array( $this, 'current_after' ), 10, 2 );
add_filter( 'upgrader_clear_destination', array( $this, 'delete_old_theme' ), 10, 4 );
$this->skin->header();
// Connect to the filesystem first.
$res = $this->fs_connect( array( WP_CONTENT_DIR ) );
if ( ! $res ) {
$this->skin->footer();
return false;
}
$this->skin->bulk_header();
/*
* Only start maintenance mode if:
* - running Multisite and there are one or more themes specified, OR
* - a theme with an update available is currently in use.
* @todo For multisite, maintenance mode should only kick in for individual sites if at all possible.
*/
Quick Info
- Hook Type: Action
- Parameters: 2
- File: wp-admin/includes/class-theme-upgrader.php
Related Hooks
Related hooks will be displayed here in future updates.