uncanny_one_click_install_plugin_installed_text
Filters the text displayed when a plugin is already installed, allowing customization of the "installed" status message.
add_filter( 'uncanny_one_click_install_plugin_installed_text', $callback, 10, 1 );
Description
Filters the text displayed for an already installed plugin in the Uncanny Automator one-click installer. Developers can modify this text to customize the "Activate" button label for any plugin, including Uncanny Automator itself, before it's rendered.
Usage
add_filter( 'uncanny_one_click_install_plugin_installed_text', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Example of how to filter the button text for an installed plugin in Uncanny One-Click Installer.
* This example will append "(Already Installed)" to the default button text.
*
* @param string $button_text The current button text for an installed plugin.
* @param stdClass $plugin_info An object containing information about the plugin.
* @return string The modified button text.
*/
add_filter( 'uncanny_one_click_install_plugin_installed_text', function( $button_text, $plugin_info ) {
// Check if the plugin is already installed. The hook is applied when it is.
// We can add additional logic here if needed, for instance, based on $plugin_info->slug or $plugin_info->name.
$modified_button_text = $button_text . ' (Already Installed)';
return $modified_button_text;
}, 10, 2 ); // 10 is the priority, 2 is the number of arguments the callback function accepts.
?>
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
src/install-automator/vendor/uncanny-one-click-installer/class-auto-plugin-install.php:574
} elseif ( $plugin_info->is_installed ) {
$action = esc_attr( 'activate' );
if ( 'uncanny-automator' === (string) $plugin_slug ) {
$button_text = esc_html__( 'Activate Uncanny Automator', 'uncanny-ceu' );
} else {
$button_text = sprintf( esc_html__( 'Activate %s', 'uncanny-ceu' ), $plugin_info->name );
}
$button_text = apply_filters( 'uncanny_one_click_install_plugin_installed_text', $button_text, $plugin_info );
}
// return button html.
ob_start();
?>
<style>