Search code examples
phpincluderequire-once

Better way to path a file using require()


require( dirname(dirname(dirname(dirname(dirname(dirname(dirname( __FILE__ ))))))).'/wp-load.php' );

this is the code im using at present. The code is in a file called config.php

This is the structure :

wordpress\wp-content\themes\\plugins\shortcodes-ultimate\lib\config.php

and I need to reach to "wordpress/wp-load.php" .

get_bloginfo() doesn't work in config.php How could I include it in a simpler manner?


Solution

  • What's wrong with

    require("../../../../../../wp-load.php");
    

    ?

    And, do you really mean for your plugin to be located within a theme?