WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I saw this message today when accessing my plugin page: custom plugin update message

So, how do I create this if I want to update my own plugins that's hosted on wordpress?

share|improve this question
up vote 8 down vote accepted

This message is created by W3_Total_Cache->in_plugin_update_message() hooked to "in_plugin_update_message-$file"in wp_plugin_update_row().

It does some nifties to parse readme and display info from changelog, but overall you can just echo some stuff as with any other hook.

share|improve this answer
Ah, that hook is what i'm looking for. Thx – ariefbayu Sep 20 '10 at 13:12

Hook building

To make the action hook name clear:

global $pagenow;
if ( 'plugins.php' === $pagenow )
    // Better update message
    $file   = basename( __FILE__ );
    $folder = basename( dirname( __FILE__ ) );
    $hook = "in_plugin_update_message-{$folder}/{$file}";
    add_action( $hook, 'your_update_message_cb', 20, 2 );

Hooked callback function

The function itself has two $variables attached: $plugins_data & $r, which can get accessed by your plugin.

 * Displays an update message for plugin list screens.
 * Shows only the version updates from the current until the newest version
 * @param (array) $plugin_data
 * @param (object) $r
 * @return (string) $output
function your_update_message_cb( $plugin_data, $r )
    // readme contents
    $data       = file_get_contents( 'http://plugins.trac.wordpress.org/browser/YOUR_PLUGIN_FOLDER_NAME_IN_THE_OFFICIAL_REPO/trunk/readme.txt?format=txt' );

    // assuming you've got a Changelog section
    // @example == Changelog ==
    $changelog  = stristr( $data, '== Changelog ==' );

    // assuming you've got a Screenshots section
    // @example == Screenshots ==
    $changelog  = stristr( $changelog, '== Screenshots ==', true );

    // only return for the current & later versions
    $curr_ver   = get_plugin_data('Version');

    // assuming you use "= v" to prepend your version numbers
    // @example = v0.2.1 =
    $changelog  = stristr( $changelog, "= v{$curr_ver}" );

    // uncomment the next line to var_export $var contents for dev:
    # echo '<pre>'.var_export( $plugin_data, false ).'<br />'.var_export( $r, false ).'</pre>';

    // echo stuff....
    $output = 'whatever you want to do';
    return print $output;


This approach can be found in the Internal link checker plugin.


plugin_basename(__FILE__) can be used instead of those two lines above. Also checking if the current page is the plugin page is not really necessary as the function will only be called by that page anyway. The (very minor) benefit still is that you don't have another callback attached. As this answer is quite old, you would, while this approach still works without a problem, now check against the object returned by get_current_screen().

share|improve this answer

Howdy, thanks to this question (and no thanks to the author of the W3TC plugin -which is a great plugin), I was able to implement a more generic version of this capability in my plugin (It starts with Version 2.1.16, so you need to play with the version of your installed plugin to see it). You can see it in this file.

The callback is near the end, and is called "in_plugin_update_message()".

It's a wee bit clunkier than I'd like, so I'll be asking a different question.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.