WordPress – update notification on plugin page

Currently, if you use WordPress plugin directory (to host your plugin), you can manage updates and version changes using SVN. Anyone who running that plugin will be notified of version changes and will have option to upgrade it automatically.

How can i add, custom message on plugin page (in dashboard) when there is update available?

Related posts

Leave a Reply

2 comments

  1. I’ve answered the same question at WordPress Answers.

    The action hook to add a custom message in the update notice is in_plugin_update_message-{$folder}/{$file}, being folder/file the ones from the plugin you want to target:

    $file   = basename( __FILE__ );
    $folder = basename( dirname( __FILE__ ) );
    $hook = "in_plugin_update_message-{$folder}/{$file}";
    add_action( $hook, 'update_message_wpse_87051', 10, 2 ); 
    
    function update_message_wpse_87051( $plugin_data, $r )
    {
        echo 'Hello World';
    }
    

    And, as you noticed “Anyone who running that plugin will be notified”, this only works for active plugins.

    PS: clarifying, it only works for an active plugin if the code is included in that plugin. If we use this code in another active plugin, or Must Use plugin, or in the theme functions.php, then the message will be displayed regardless of the target plugin being active or not.

  2. function pluginUpdateMessaage($data, $response){
      
    printf(
            '<div class="update-message"><p><strong>%s</strong></p></div>',
            __( 'Version 2.3.4 is a recommended update message', 'text-domain' )
        );
    }
    
    add_action('in_plugin_update_message-your-plugin/your-plugin.php','pluginUpdateMessage',10,2);