apply_filters( ‘upgrader_post_install’, bool $response, array $hook_extra, array $result )

Filters the installation response after the installation has finished.

Parameters

$responsebool
Installation response.
$hook_extraarray
Extra arguments passed to hooked filters.
$resultarray
Installation result data.

Source

$res = apply_filters( 'upgrader_post_install', true, $args['hook_extra'], $this->result );

Changelog

VersionDescription
2.8.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    You can use this filter to distinguish between your plugin being installed for the first time or an upgrade over an existing installation. This could be useful in the scenario where you need to publish some admin notices to users on specific version upgrades.

    add_filter( 'upgrader_post_install', 'wpdocs_plugin_update', 10, 3 );
    function wpdocs_plugin_update( $response, $extras, $result ) {
      if ( isset( $result['destination_name'] ) && 'wpdocs-plugin-slug' === $result['destination_name'] && $response ) {
        $my_settings           = get_option( 'wpdocs-plugin-options', array() );
        $my_settings['update'] = true;
        update_option( 'wpdocs-plugin-options', $my_settings );
      }
    
      return $response;
    }

    you can then consult your plugin settings to see if this is an updated version.

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