The core_upgrade_preamble WordPress PHP action fires after the core, plugin, and theme update tables have been displayed on the updates page.
Usage
add_action('core_upgrade_preamble', 'your_custom_function'); function your_custom_function() { // your custom code here }
Parameters
This action has no parameters.
More information
See WordPress Developer Resources: core_upgrade_preamble
Examples
Display a message after the update tables
In this example, we display a message to the user after the update tables.
add_action('core_upgrade_preamble', 'display_update_message'); function display_update_message() { echo '<p><strong>Note:</strong> Always create a backup of your site before updating!</p>'; }
Log plugin update information
In this example, we log the plugin update information after the update tables.
add_action('core_upgrade_preamble', 'log_plugin_update_information'); function log_plugin_update_information() { $plugins = get_site_transient('update_plugins'); error_log(print_r($plugins, true)); }
Add custom styles to the update page
In this example, we enqueue a custom stylesheet for the update page after the update tables.
add_action('core_upgrade_preamble', 'add_custom_styles_to_update_page'); function add_custom_styles_to_update_page() { wp_enqueue_style('custom-update-page', get_stylesheet_directory_uri() . '/custom-update-page.css'); }
Display a maintenance mode warning
In this example, we display a warning to the user that the site may be put into maintenance mode during updates.
add_action('core_upgrade_preamble', 'display_maintenance_mode_warning'); function display_maintenance_mode_warning() { echo '<p><strong>Warning:</strong> Your site may be put into maintenance mode during updates.</p>'; }
Add a custom button after the update tables
In this example, we add a custom button to the update page after the update tables.
add_action('core_upgrade_preamble', 'add_custom_button_to_update_page'); function add_custom_button_to_update_page() { echo '<a href="https://example.com/custom-action" class="button">Perform Custom Action</a>'; }