I have this structure on my website:

enter image description here

And inside the game folder (the index.php file) I'm trying to call WooCommerce and WordPress functions, to see if the user has a membership (I'm using WooCommerce Membership plugin).

With this code:

require_once('../wp-load.php' );

if (wc_memberships_is_post_content_restricted($id) && !wc_memberships_is_user_member() && !current_user_can('administrator')) {
     header("Location: https:/localhost/mywebsite");

wc_memberships_is_post_content_restricted(); is a WooCommerce Membership function... on the localserver (wampserver) it's working, but when I try to run on my online host the functions do not work.

I also used var_dump( get_defined_functions() ); to see if the functions are properly load, and it's...

  • 1
    "...and it's..." what? The SkyVerge team are really good about providing support so you should reach out to them to ask about functions that exist within their plugin. Third-Party plugins and WooCommerce are off-topic on WPSE. Jan 20, 2021 at 15:22

1 Answer 1


When I am using a php script in my Wordpress installation, I have special functions in the child theme, in functions.php So I have to require that as well.

Also you want to make sure that SHORTINIT is not defined as TRUE, or else you lose many Wordpress functions.

Here is how I do it.

require( $path.'/wp-load.php' );
require_once( get_stylesheet_directory() . '/../Divi-child/functions.php' );
// now all my functions are loaded

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.