Skip to content

Instantly share code, notes, and snippets.

@kousherAlam
Created July 25, 2017 06:23
Show Gist options
  • Save kousherAlam/60ec5322d7bc1e734e11bd87dfdfe05b to your computer and use it in GitHub Desktop.
Save kousherAlam/60ec5322d7bc1e734e11bd87dfdfe05b to your computer and use it in GitHub Desktop.
define( 'SHORTINIT', true );
$url = (!empty($_SERVER['HTTPS'])) ? "https://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'] : "http://".$_SERVER['SERVER_NAME'].$_SERVER['REQUEST_URI'];
$url = $_SERVER['REQUEST_URI'];
$my_url = explode('wp-content' , $url);
$path = $_SERVER['DOCUMENT_ROOT']."/".$my_url[0];
@kousherAlam
Copy link
Author

Now path variable is in the root of your wordpress directory.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment