Filter uncanny-automator

automator_admin_tools_tabs

Filters the tabs displayed in the Automator Admin Tools section for customization.

add_filter( 'automator_admin_tools_tabs', $callback, 10, 1 );

Description

Filters the array of top-level admin tool tabs for the Automator plugin. Developers can use this hook to add, remove, or modify tabs displayed in the main admin tools section, influencing the plugin's navigation structure. This filter fires during the initialization of the admin tools page.


Usage

add_filter( 'automator_admin_tools_tabs', 'your_function_name', 10, 1 );

Return Value

The filtered value.


Examples

add_filter(
	'automator_admin_tools_tabs',
	function( $tabs ) {
		// Add a new custom tab to the automator admin tools.
		// This example assumes you have a function that generates the HTML for this tab's content.
		// Replace 'my_custom_automator_tab' and 'My Custom Tool' with your actual tab ID and title.
		// Replace 'render_my_custom_automator_tab_content' with the actual function that renders your tab's content.
		$tabs['my_custom_automator_tab'] = array(
			'title'    => __( 'My Custom Tool', 'your-text-domain' ),
			'callback' => 'render_my_custom_automator_tab_content',
		);

		return $tabs;
	},
	10, // Priority: standard priority for adding items
	1  // Accepted args: only the original $tabs array is needed
);

// Example of the callback function that would render the content of the custom tab.
// This function should be defined elsewhere in your plugin or theme.
if ( ! function_exists( 'render_my_custom_automator_tab_content' ) ) {
	function render_my_custom_automator_tab_content() {
		?>
		<div class="wrap">
			<h2><?php _e( 'My Custom Automator Tool', 'your-text-domain' ); ?></h2>
			<p><?php _e( 'This is the content of my custom automator tool tab. You can add your own settings, reports, or actions here.', 'your-text-domain' ); ?></p>
			<?php
			// Add your custom form fields, buttons, or any other HTML elements here.
			?>
		</div>
		<?php
	}
}

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/admin/admin-tools/admin-tools.php:105

public function get_top_level_tabs() {

		return apply_filters( 'automator_admin_tools_tabs', array() );
	}

Scroll to Top