Filter
uncanny-automator-pro
uap_pro_in_plugin_update_message
Filters the plugin update notice message displayed to users for specific upgrades.
add_filter( 'uap_pro_in_plugin_update_message', $callback, 10, 1 );
Description
Filters the upgrade notice message displayed for Uncanny Automator Pro. Developers can modify the `$upgrade_notice` string to customize or completely replace the default message shown to users during plugin updates. This hook fires after the upgrade notice content is generated and before it's displayed.
Usage
add_filter( 'uap_pro_in_plugin_update_message', 'your_function_name', 10, 1 );
Parameters
-
$upgrade_notice(mixed) - This parameter contains the upgrade notice message, which is a string that can be HTML-formatted.
Return Value
The filtered value.
Examples
<?php
/**
* Example of how to hook into the 'uap_pro_in_plugin_update_message' filter.
* This filter allows you to modify the upgrade notice displayed in the WordPress plugin list.
*
* @param string $upgrade_notice The original upgrade notice HTML.
* @return string The modified upgrade notice HTML.
*/
add_filter( 'uap_pro_in_plugin_update_message', 'my_custom_uap_upgrade_notice', 10, 1 );
function my_custom_uap_upgrade_notice( $upgrade_notice ) {
// Check if there's an existing upgrade notice and if it's not empty.
if ( ! empty( $upgrade_notice ) ) {
// Example: Add a custom link to our documentation for specific upgrade notices.
// We'll assume the original notice might contain a specific keyword like "new feature".
if ( strpos( $upgrade_notice, 'new feature' ) !== false ) {
$custom_link = '<a href="https://example.com/docs/automator-new-feature-guide" target="_blank">Read the new feature guide</a>';
$upgrade_notice = str_replace( '</p>', '</p><p>' . $custom_link . '</p>', $upgrade_notice );
}
// Example: Add a call to action to check out a blog post about the update.
$blog_post_link = '<a href="https://example.com/blog/uncanny-automator-pro-update-x-y-z" target="_blank">Learn more about this update on our blog</a>';
$upgrade_notice .= '<p>' . $blog_post_link . '</p>';
} else {
// If there's no existing notice, you could potentially add a generic one,
// but it's generally better to leverage the plugin's provided notices.
// For this example, we'll just return an empty string if no notice exists.
return '';
}
// Return the modified upgrade notice.
return $upgrade_notice;
}
?>
Placement
This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.
Source Code
uncanny-automator-pro/src/boot.php:351
public function in_plugin_update_message( $args, $response ) {
$upgrade_notice = '';
if ( isset( $response->upgrade_notice ) && ! empty( $response->upgrade_notice ) ) {
$upgrade_notice .= '<p class="ua_plugin_upgrade_notice">';
$upgrade_notice .= sprintf( '<strong>%s</strong> %s', esc_html_x( 'Heads up!', 'Upgrade notice', 'uncanny-automator' ), preg_replace( '~[([^]]*)](([^)]*))~', '<a href="${2}">${1}</a>', $response->upgrade_notice ) );
$upgrade_notice .= '</p>';
}
echo apply_filters( 'uap_pro_in_plugin_update_message', wp_kses_post( $upgrade_notice ) ? '</p>' . wp_kses_post( $upgrade_notice ) . '<p class="dummy">' : '' ); // phpcs:ignore WordPress.XSS.EscapeOutput.OutputNotEscaped, WordPress.Security.EscapeOutput.OutputNotEscaped
}