Yoast_Plugin_Conflict::remove_deactivated_plugin()privateYoast 1.0

When being in the deactivation process the currently deactivated plugin has to be removed.

Метод класса: Yoast_Plugin_Conflict{}

Хуков нет.

Возвращает

null. Ничего (null).

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

// private - только в коде основоного (родительского) класса
$result = $this->remove_deactivated_plugin();

Код Yoast_Plugin_Conflict::remove_deactivated_plugin() Yoast 22.3

private function remove_deactivated_plugin() {
	// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: On the deactivation screen the nonce is already checked by WordPress itself.
	if ( ! isset( $_GET['plugin'] ) || ! is_string( $_GET['plugin'] ) ) {
		return;
	}

	// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Reason: On the deactivation screen the nonce is already checked by WordPress itself.
	$deactivated_plugin = sanitize_text_field( wp_unslash( $_GET['plugin'] ) );
	$key_to_remove      = array_search( $deactivated_plugin, $this->all_active_plugins, true );

	if ( $key_to_remove !== false ) {
		unset( $this->all_active_plugins[ $key_to_remove ] );
	}
}