current_user_switched() undefined | WordPress.org

[ad_1]

I’m having the weirdest issue on a site I’m working on locally. I have the user switching plugin active and I’m trying to display a message if I’ve switched to a user. I have the following code just for testing:

if ( current_user_switched() ) {
ray( ‘switched’ );
} else {
ray( ‘not switched’ );
}

In my browser, I’m logged in and switched to a user, but when I refresh the page, I get a “call to undefined function” error about current_user_switched().

I went into the user-switching.php file and found the function definition… I added the following:
if ( ! function_exists( ‘current_user_switched’ ) ) {
ray( ‘here’);

And the ray call fires, but I still get the undefined error.

Any chance you can tell me what I’m doing wrong here?

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer