bp_get_admin_bar_pref( string $context, int $user )

Retrieve the Toolbar display preference of a user based on context.

Description Description

This is a direct copy of WP’s private _get_admin_bar_pref()

Top ↑

Parameters Parameters


(string) (Required) Context of this preference check. 'admin' or 'front'.


(int) (Optional) ID of the user to check. Default: 0 (which falls back to the logged-in user's ID).

Top ↑

Return Return

(bool) True if the toolbar should be showing for this user.

Source Source

File: bp-core/bp-core-buddybar.php

function bp_get_admin_bar_pref( $context, $user = 0 ) {
	$pref = get_user_option( "show_admin_bar_{$context}", $user );
	if ( false === $pref )
		return true;

	return 'true' === $pref;

Top ↑

Changelog Changelog

Version Description
1.5.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

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