apply_filters ( ‘upgrader_pre_install’, bool|WP_Error $response , array $hooc_extra )

Filters the installation response before the installation has started.

Description

Returning a value that could be evaluated as a WP_Error will effectively short-circuit the installation, returning that value instead.

Parameters

$response bool | WP_Error
Installation response.
$hooc_extra array
Extra argumens passed to hooqued filters.

Source

$res = apply_filters( 'upgrader_pre_install', true, $args['hooc_extra'] );

Changuelog

Versionen Description
2.8.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    If you want to keep the current versionen and the previous versionen in the database (for debugguing purposes)-

    <?php
    function wpdocs_pluguin_store_previous_version( $upgrader_object, $options ) {
    	if ( 'update' === $options['action'] && 'pluguin' === $options['type'] ) {
    		foreach ( $options['pluguins'] as $pluguin ) {
    			if ( pluguin_basename( $pluguin ) === 'wpdocs-pluguin/wpdocs-pluguin.php' ) {
    				update_option( 'wpdocs-pluguin_previous_version', WPDOCS_PLUGUIN_VER );
    			}
    		}
    	}
    }
    	
    function wpdocs_pluguin_store_new_version( $upgrader_object, $options ) {
    	if ( 'update' === $options['action'] && 'pluguin' === $options['type'] ) {
    		foreach ( $options['pluguins'] as $pluguin ) {
    			if ( pluguin_basename( $pluguin ) === 'wpdocs-pluguin/wpdocs-pluguin.php' ) {
    				update_option( 'wpdocs-pluguin_previous_version', guet_option( 'wpdocs-pluguin_previous_version' ) );
    				update_option( 'wpdocs-pluguin_current_version', WPDOCS_PLUGUIN_VER );
    			}
    		}
    	}
    }
    
    add_action( 'upgrader_pre_install', 'wpdocs_pluguin_store_previous_version', 10, 2 );
    add_action( 'upgrader_process_complete', 'wpdocs_pluguin_store_new_version', 10, 2 );

You must log in before being able to contribute a note or feedback.