Filter
uncanny-automator
automator_admin_logs_top_level_tabs_items
Filters the main tabs displayed in the Automator admin logs area before they are rendered.
add_filter( 'automator_admin_logs_top_level_tabs_items', $callback, 10, 1 );
Description
Filters the array of top-level tabs displayed in the Automator admin logs. Developers can add, remove, or modify tab items to customize the admin logs interface. This hook fires when the top-level tabs are being retrieved.
Usage
add_filter( 'automator_admin_logs_top_level_tabs_items', 'your_function_name', 10, 1 );
Return Value
The filtered value.
Examples
<?php
/**
* Add a custom tab to the Automator admin logs.
*
* This function hooks into the 'automator_admin_logs_top_level_tabs_items'
* filter to add a new tab for "Custom Logs" to the admin logs section.
*
* @param array $tabs An array of existing tabs.
* @return array The modified array of tabs including the new custom tab.
*/
function my_automator_add_custom_log_tab( $tabs ) {
// Define the new tab's properties.
$custom_tab = array(
'id' => 'my_custom_logs',
'label' => __( 'Custom Logs', 'your-text-domain' ),
'url' => admin_url( 'admin.php?page=automator-logs&tab=my_custom_logs' ),
);
// Append the new tab to the existing tabs array.
$tabs[] = $custom_tab;
return $tabs;
}
// Add the filter with the correct number of arguments (1 for the array).
add_filter( 'automator_admin_logs_top_level_tabs_items', 'my_automator_add_custom_log_tab', 10, 1 );
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-logs/admin-logs.php:122
public function get_top_level_tabs() {
return apply_filters( 'automator_admin_logs_top_level_tabs_items', array() );
}