I get the error Fatal error: Uncaught Error: Call to undefined function get_current_site() in XXXXXXXX
Why is this happening? Do I need to load something before I can use that function? Is my Installation wrong?
Thanks in advance
PS: my Code (if you need it)
$f = function () {
ob_start();
var_dump(get_current_site());
file_put_contents(__DIR__ . '/dump.html', ob_get_clean());
return;
// I actually want to put styles here later, which change with every page
};
add_action('wp_enqueue_scripts', $f);
I get the error Fatal error: Uncaught Error: Call to undefined function get_current_site() in XXXXXXXX
Why is this happening? Do I need to load something before I can use that function? Is my Installation wrong?
Thanks in advance
PS: my Code (if you need it)
$f = function () {
ob_start();
var_dump(get_current_site());
file_put_contents(__DIR__ . '/dump.html', ob_get_clean());
return;
// I actually want to put styles here later, which change with every page
};
add_action('wp_enqueue_scripts', $f);
get_current_site()
is a function for getting the current Multisite Network. As with other multisite-related functions, it is not available to use if your site is not configured as a multisite network.
I can't tell from your code what you're attempting to use the function for, so I can't offer a suggestion for what to use instead.
If you want to check if you're on a specific page you can use is_page()
along with the slug of ID if the page you're checking for:
if ( is_page( 'about-us' ) ) {
}
if ( is_page( 5 ) ) {
}