wp_enqueue_admin_bar_header_styles()

In this article

Enqueues inline style to hide the admin bar when printing.

Source

function wp_enqueue_admin_bar_header_styles() {	// Back-compat for plugins that disable functionality by unhooking this action.	$action = is_admin() ? 'admin_head' : 'wp_head';	if ( ! has_action( $action, 'wp_admin_bar_header' ) ) {	return;	}	remove_action( $action, 'wp_admin_bar_header' );	wp_add_inline_style( 'admin-bar', '@media print { #wpadminbar { display:none; } }' ); } 

Changelog

VersionDescription
6.4.0Introduced.

User Contributed Notes

You must log in before being able to contribute a note or feedback.