uncanny_one_click_install_plugin_initial_text
Filters the initial button text displayed during the one-click plugin installation process.
add_filter( 'uncanny_one_click_install_plugin_initial_text', $callback, 10, 2 );
Description
Filters the initial text displayed on the one-click plugin installation button. Developers can modify this text to customize button labels, perhaps to prepend or append specific information or translate the default strings dynamically. This hook fires just before the button text is output.
Usage
add_filter( 'uncanny_one_click_install_plugin_initial_text', 'your_function_name', 10, 2 );
Parameters
-
$button_text(mixed) - This parameter contains the current text of the installation button, which can be modified by the filter.
-
$plugin_info(mixed) - This parameter contains the initial text for the install button.
Return Value
The filtered value.
Examples
/**
* Modify the initial button text for the Uncanny Automator plugin installation.
*
* This example changes the default "Install Uncanny Automator" text to something
* more specific when the Uncanny Automator plugin is being considered for installation.
*
* @param string $button_text The current button text.
* @param object $plugin_info An object containing information about the plugin.
* @return string The modified button text.
*/
add_filter(
'uncanny_one_click_install_plugin_initial_text',
function( $button_text, $plugin_info ) {
// Check if the plugin slug is specifically for Uncanny Automator.
if ( isset( $plugin_info->slug ) && 'uncanny-automator' === $plugin_info->slug ) {
// Change the button text for Uncanny Automator.
$button_text = sprintf(
// Translators: This is the text displayed on the button to install Uncanny Automator.
esc_html__( 'Get Started with Uncanny Automator', 'your-text-domain' )
);
} elseif ( isset( $plugin_info->slug ) && 'another-important-plugin' === $plugin_info->slug ) {
// Example: Modifying text for another specific plugin.
$button_text = sprintf(
// Translators: This is the text displayed on the button to install Another Important Plugin.
esc_html__( 'Add %s Now', 'your-text-domain' ),
esc_html( $plugin_info->name )
);
}
// Return the potentially modified button text.
return $button_text;
},
10, // Priority: Default WordPress priority.
2 // Accepted args: The filter accepts $button_text and $plugin_info.
);
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:560
if ( 'uncanny-automator' === (string) $plugin_slug ) {
$button_text = esc_html__( 'Install Uncanny Automator', 'uncanny-ceu' );
} else {
$button_text = sprintf( esc_html__( 'Install %s', 'uncanny-ceu' ), $plugin_info->name );
}
$button_text = apply_filters( 'uncanny_one_click_install_plugin_initial_text', $button_text, $plugin_info );
if ( $plugin_info->is_active ) {
$action = esc_attr( '' );
$disabled = esc_attr( 'disabled="disabled"' );
$button_text = sprintf( esc_html__( '%s is active', 'uncanny-ceu' ), $plugin_info->name );
$button_text = apply_filters( 'uncanny_one_click_install_plugin_active_text', $button_text, $plugin_info );
} elseif ( $plugin_info->is_installed ) {