apply_filters( 'lp__admin_toolbar_args', $args )
Allow filter for all admin toolbar arguments during its preparation for registration.
Plugin
Namespace
Launchpad
Parameters
array
$args
Admin toolbar arguments
Return
array
Filtered admin toolbar arguments
Example
Here’s how you can customize the admin toolbar arguments to add a new test menu item:
// Add the filter hook for customizing all admin toolbar arguments
add_filter( 'lp__admin_toolbar_args', function ( $args ) {
// Add a test menu item to the admin toolbar
$args['menus'][] = array(
'id' => 'test_menu',
'title' => 'Test Menu',
'capability' => 'read',
'href' => 'https://example.com/',
'meta' => array(
'target' => '_blank'
),
);
// Return the modified admin toolbar arguments
return $args;
});
After applying this customization, a new menu item titled ‘Test Menu’ will be added to the WordPress admin toolbar. Clicking on this menu item will take the user to ‘https://example.com/‘ in a new tab/window, as specified by the href attribute.