do_action( "in_plugin_update_message-{$file}", array $plugin_data, array $response )

Fires at the end of the update message container in each row of the plugins list table.


Description Description

The dynamic portion of the hook name, $file, refers to the path of the plugin’s primary file relative to the plugins directory.


Top ↑

Parameters Parameters

$plugin_data

(array) An array of plugin metadata.

  • 'name'
    (string) The human-readable name of the plugin.
  • 'plugin_uri'
    (string) Plugin URI.
  • 'version'
    (string) Plugin version.
  • 'description'
    (string) Plugin description.
  • 'author'
    (string) Plugin author.
  • 'author_uri'
    (string) Plugin author URI.
  • 'text_domain'
    (string) Plugin text domain.
  • 'domain_path'
    (string) Relative path to the plugin's .mo file(s).
  • 'network'
    (bool) Whether the plugin can only be activated network wide.
  • 'title'
    (string) The human-readable title of the plugin.
  • 'author_name'
    (string) Plugin author's name.
  • 'update'
    (bool) Whether there's an available update. Default null.

$response

(array) An array of metadata about the available plugin update.

  • 'id'
    (int) Plugin ID.
  • 'slug'
    (string) Plugin slug.
  • 'new_version'
    (string) New plugin version.
  • 'url'
    (string) Plugin URL.
  • 'package'
    (string) Plugin update package URL.


Top ↑

Source Source

File: wp-admin/includes/update.php

View on Trac



Top ↑

Changelog Changelog

Changelog
Version Description
2.8.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

  1. Skip to note 1 content
    Contributed by Geoffrey

    $response seems to be an object, not an array here.

    I used this hook to be able to display an upgrade notice message just after the new version message, like so:

    function wpdocs_plugin_update_message( $plugin_data, $new_data ) {
    	if ( isset( $plugin_data['update'] ) && $plugin_data['update'] && isset( $new_data->upgrade_notice ) ) {
    		printf(
    			'<div class="update-message"><p><strong>%s</strong>: %s</p></div>',
    			$new_data -> new_version,
    			wpautop( $new_data -> upgrade_notice )
    		);
    	}
    }
    add_action( 'in_plugin_update_message-my-plugin-name/my-plugin-name.php', 'wpdocs_plugin_update_message', 10, 2 );

    But it seems like upgrade_notice isn’t available anymore. This code is still a good way to warn user for important upgrades. :)

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