Action Dynamic uncanny-automator

automator_admin_tools_status_{dynamic}_tab

> **Note:** This is a dynamic hook. The actual hook name is constructed at runtime. Fires when a tab within the Automator admin tools section is displayed, allowing for dynamic tab-specific customizations.

add_action( 'automator_admin_tools_status_{dynamic}_tab', $callback, 10, 1 );

Description

Fires when the status tab within Automator's admin tools is rendered. Developers can use this action to add custom content, tabs, or functionality to the status page. The `$tab_key` in the hook name is dynamic, so ensure your hook properly targets the desired tab.


Usage

add_action( 'automator_admin_tools_status_{dynamic}_tab', 'your_function_name', 10, 1 );

Examples

add_action( 'automator_admin_tools_status_general_tab', 'my_automator_add_custom_status_info', 10, 0 );
/**
 * Adds custom information to the Automator General Status tab.
 *
 * This function demonstrates how to hook into the 'automator_admin_tools_status_general_tab'
 * action to display additional details or status checks specific to your plugin or theme
 * within the Uncanny Automator admin area.
 */
function my_automator_add_custom_status_info() {
	// Example: Check if a specific external service is reachable.
	$service_url = 'https://api.example.com/status';
	$response_code = wp_remote_get( $service_url, array( 'timeout' => 5 ) );

	if ( is_wp_error( $response_code ) ) {
		echo '<div class="notice notice-error"><p><strong>My Custom Check:</strong> Failed to connect to the external service. Error: ' . esc_html( $response_code->get_error_message() ) . '</p></div>';
	} elseif ( 200 === wp_remote_retrieve_response_code( $response_code ) ) {
		echo '<div class="notice notice-success"><p><strong>My Custom Check:</strong> Successfully connected to the external service.</p></div>';
	} else {
		echo '<div class="notice notice-warning"><p><strong>My Custom Check:</strong> Connected to the external service, but received an unexpected status code: ' . esc_html( wp_remote_retrieve_response_code( $response_code ) ) . '</p></div>';
	}

	// Example: Display a count of items from your custom post type.
	$custom_post_type = 'my_custom_data';
	$count_args = array(
		'post_type'      => $custom_post_type,
		'post_status'    => 'publish',
		'posts_per_page' => -1,
	);
	$custom_posts = get_posts( $count_args );
	$custom_post_count = count( $custom_posts );

	echo '<p><strong>My Custom Data Count:</strong> You have ' . esc_html( $custom_post_count ) . ' published items of type "' . esc_html( $custom_post_type ) . '".</p>';
}

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/views/admin-tools/tab/status.php:10

* Status > Status
 *
 * @since   4.5
 */

namespace Uncanny_Automator;

do_action( 'automator_admin_tools_status_' . $tab_key . '_tab' );

Scroll to Top