Filter
uncanny-automator
automator_after_settings_extra_buttons
Filters the extra buttons displayed after core settings buttons to allow modification or addition.
add_filter( 'automator_after_settings_extra_buttons', $callback, 10, 3 );
Description
Fires after the default extra buttons are generated in the Automator settings. Developers can use this filter to add, remove, or modify the buttons displayed in the Automator settings interface, allowing for custom actions or integrations. The `$extra_buttons`, `$active` status, and current `$tab` are passed.
Usage
add_filter( 'automator_after_settings_extra_buttons', 'your_function_name', 10, 3 );
Parameters
-
$extra_buttons(mixed) - This parameter contains an array of HTML strings representing extra buttons to be displayed in the Automator settings.
-
$active(mixed) - This parameter contains an array or string representing additional buttons to be displayed within the Automator plugin's settings section.
-
$tab(mixed) - This parameter indicates whether the current settings tab is active.
Return Value
The filtered value.
Examples
<?php
/**
* Add a custom button to the Automator settings page for a specific tab.
*
* This example adds a "Reset Settings" button to the "General" tab of the
* Automator plugin's settings page, which, when clicked, would ideally trigger
* a confirmation and then reset specific plugin settings.
*/
add_filter(
'automator_after_settings_extra_buttons',
function( $extra_buttons, $active_tab, $current_tab ) {
// Only add the button to the 'general' tab.
if ( 'general' === $current_tab ) {
// You would typically enqueue a script to handle the button's click event.
// For this example, we'll just add a simple button.
$reset_button = '<button type="button" class="button button-secondary" id="automator-reset-settings">';
$reset_button .= esc_html__( 'Reset Automator Settings', 'your-text-domain' );
$reset_button .= '</button>';
// Append the new button to the existing extra buttons.
$extra_buttons .= $reset_button;
}
return $extra_buttons;
},
10, // Priority
3 // Accepted args: $extra_buttons, $active, $tab
);
?>
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/core/includes/automator-settings.php:159
src/core/includes/automator-settings.php:317
'',
$active,
$tab,
),
'3.0',
'automator_after_settings_extra_buttons'
);
$extra_buttons = apply_filters( 'automator_after_settings_extra_buttons', $extra_buttons, $active, $tab );
ob_start();
echo $extra_buttons; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo ob_get_clean(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
?>
</div>
<?php
do_action_deprecated( 'uap_after_automator_settings', array(), '3.0', 'automator_after_settings' );