How to call display_sidebar from functions.php

Hi. I’m trying to access the return value of display_sidebar() inside functions.php, but I get a fatal error:

Fatal error: Call to undefined function display_sidebar()

I’ve tried to include both the setup and** wrapper** namespaces in functions, but with no luck.

I’m no PHP master, so learning as I go, and thus I have to ask here since I do not know if it’s “PHP or Sage” related.

My overgoal is to use ACF’s acf/input/admin_head filter to hide some fields in admin on the pages where the sidebar is not displayed.

Any ideas, please? :microscope:

This post isn’t really helpful without any actual code. Please post your code.

On top in functions.php:

use Roots\Sage\Setup;
use Roots\Sage\Wrapper;

My function:

function my_acf_admin_head()
{

if (!Setup\display_sidebar()) {
echo $css;
}
}
add_action(‘acf/input/admin_head’, ‘my_acf_admin_head’);