• I’m trying to require_once a file in another directory in a WP plugin. I always get “This plugin has been deactivated because your changes resulted in a fatal error.” when I activate the plugin. When I remove require_once() everything works fine (well not ‘fine’) but there are no errors. This is just the piece of the code that I’m having trouble with. 🙂

    Is there another way to include an external file in a WP plugin? (as for the file to be included, it’s at “/home/DIR/public_html/SITE/FOLDER/global.php”)

    <?php
    $vwd = ‘/home/DIR/public_html/SITE/FOLDER’;
    $cwd = getcwd();
    chdir($vwd);
    //only the next line causes a fatal error.
    require_once(‘./global.php’);
    chdir($cwd);
    ?>

The topic ‘How do I require_once()?’ is closed to new replies.