English (United Kingdom)
Knowledge Base  >  VikUpdater  >  Developers  >  Plugins  >  Prepare Update Data

apply_filters( 'vikupdater_prepare_update_plugin_data', object $update, object $manifest, array $options )

Filter used to set up the update data that will be used by WordPress.


Description

The information used here will be saved within the transient used by WordPress to check whether there is an update available for a specific plugin.

The Dashboard > Updates page displays a default image for those plugins that do not specify an image as program icon. It is possible to use this hook to use a custom image instead.


Parameters

$update

(object)  The object holding the plugin update details, compatible with the WordPress requirements.

$manifest

(object)  The plugin manifest (JSON-decoded) fetched through the API call made on the plugin "check" URL.

$options

(array)  A configuration array, taken from the associative array specified during the subscription of the plugin.


Example

The example below explains how to add custom icons for a specific plugin.

function your_plugin_vikupdater_prepare_update_data( $update, $manifest, $options ) {
    // make sure we are observing our plugin
    if ( 'your-plugin' === $update->slug ) {
        // register the plugin icons
        $update->icons = [
            '2x' => plugin_dir_url(__FILE__) . 'images/logo-256x256.png',
            '1x' => plugin_dir_url(__FILE__) . 'images/logo-128x128.png',
        ];
    }

    return $update;
}

add_filter( 'vikupdater_prepare_update_plugin_data', 'your_plugin_vikupdater_prepare_update_data', 10, 3 );

Changelog

Version Description
2.0 Introduced.
Last Update: 2023-11-21
Helpful?