Skip to content

Instantly share code, notes, and snippets.

@Darklg
Created August 9, 2017 13:13
Show Gist options
  • Save Darklg/5f0e558146ea2416df8ce9b3a1a65b1f to your computer and use it in GitHub Desktop.
Save Darklg/5f0e558146ea2416df8ce9b3a1a65b1f to your computer and use it in GitHub Desktop.
Bootstrapping WordPress
<?php
/* Start in the correct directory */
chdir(dirname(__FILE__));
$bootstrap = 'wp-load.php';
while (!is_file($bootstrap))
/* If there is a parent directory and we are not in the root dir */
if (is_dir('..') && getcwd() != '/') {
chdir('..');
} else {
die('EN: Could not find WordPress! FR : Impossible de trouver WordPress !');
}
}
require_once $bootstrap;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment