WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Plugin_Upgrader::deactivate_plugin_before_upgrade() public WP 2.8.0

Deactivates a plugin before it is upgraded.

Hooked to the 'upgrader_pre_install' filter by Plugin_Upgrader::upgrade().

Это метод класса: Plugin_Upgrader{}

Хуков нет.

Возвращает

true/false/WP_Error. The passed in $return param or WP_Error.

Использование

$Plugin_Upgrader = new Plugin_Upgrader();
$Plugin_Upgrader->deactivate_plugin_before_upgrade( $return, $plugin );
$return(true/false/WP_Error) (обязательный)
Upgrade offer return.
$plugin(массив) (обязательный)
Plugin package arguments.

Список изменений

С версии 2.8.0 Введена.
С версии 4.1.0 Added a return value.

Код Plugin Upgrader::deactivate plugin before upgrade: wp-admin/includes/class-plugin-upgrader.php WP 5.5.1

<?php
public function deactivate_plugin_before_upgrade( $return, $plugin ) {

	if ( is_wp_error( $return ) ) { // Bypass.
		return $return;
	}

	// When in cron (background updates) don't deactivate the plugin, as we require a browser to reactivate it.
	if ( wp_doing_cron() ) {
		return $return;
	}

	$plugin = isset( $plugin['plugin'] ) ? $plugin['plugin'] : '';
	if ( empty( $plugin ) ) {
		return new WP_Error( 'bad_request', $this->strings['bad_request'] );
	}

	if ( is_plugin_active( $plugin ) ) {
		// Deactivate the plugin silently, Prevent deactivation hooks from running.
		deactivate_plugins( $plugin, true );
	}

	return $return;
}