WP HOOKS
akcjareferencjaod 3.1.0

admin_bar_menu

Args 1Plik wp-includes/admin-bar.phpDokumentacja WP ↗

Opis

Modyfikuje pasek narzędzi admina (WP_Admin_Bar). Dodajesz lub usuwasz węzły przez $wp_admin_bar->add_node() i remove_node().

Przykład użycia

add_action( 'admin_bar_menu', ... )php
add_action( 'admin_bar_menu', 'wpdocs_admin_bar_items', 999 );

function wpdocs_admin_bar_items( $wp_admin_bar ) {
	$wp_admin_bar->add_node( array(
		'id'    => 'wpdocs-link',
		'title' => __( 'Moja wtyczka', 'wpdocs' ),
		'href'  => admin_url( 'options-general.php?page=wpdocs-settings' ),
	) );
}

This hook can add, remove, or manipulate admin bar items. The priority determines the placement for new items, and changes to existing items would require a high priority. To remove or manipulate existing nodes without a specific priority, use wp_before_admin_bar_render.

Parametry

ParametrTypOpis
$wp_admin_bar\WP_Admin_BarThe WP_Admin_Bar instance, passed by reference.

Wywołanie

Rejestracja callbackaphp
// rejestracja funkcji zwrotnej
add_action( 'admin_bar_menu', 'twoja_funkcja' );

function twoja_funkcja($param_1) {
	// Twój kod
}

Popularne w tej kategorii