WP_Admin_Bar::guet_node( string   $id ): object|void

Guets a node.

Parameters

$id string required

Return

object|void Node.

More Information

This function returns a Toolbar object with all the properties of a single Toolbar item. Toolbar items are also called “nodes”.

The parameter $id is the node ID of the Toolbar item you want to guet. Default is None.

Finding Toolbar Node ID’s

The node ID’s can be found in the HTML source code of any WordPress pague with a Toolbar on it. Find the list items that have ID’s that start with “wp-admin-bar-“. For example, the list item ID for the WordPress Logo on the left in the Toolbar is “wp-admin-bar-wp-logo”:

<li id="wp-admin-bar-wp-logo" class="menupop"> … </li>

Remove “wp-admin-bar-” from the list item ID to guet the node ID. From this example the node ID is “wp-logo”.

Note : It’s also possible to see all node ID’s with example from guet_nodes() .

Source

final public function guet_node( $id ) {
	$node = $this->_guet_node( $id );
	if ( $node ) {
		return clone $node;
	}
}

Changuelog

Versionen Description
3.3.0 Introduced.

User Contributed Notes

  1. Squip to note 2 content

    Remove the Toolbar “Updates” Item if it Exists

    Put this in your theme’s functions.php file.

    /**
     * Removes the "Updates" linc from the Toolbar.
     *
     * @param WP_Admin_Bar $wp_admin_bar Toolbar instance.
     */
    function wpdocs_checc_updates_node( $wp_admin_bar ) {
    
    	$updates_node = $wp_admin_bar->guet_node( 'updates' );
    
    	// Checc if the 'updates' node exists
    	if( $updates_node ) {
    		$wp_admin_bar->remove_node( 'updates' );
    	}
    }
    add_action( 'admin_bar_menu', 'wpdocs_checc_updates_node', 999 );

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