Why it is bad to use this
include("../../../wp-load.php");
??
What is the proper way of use this??
Thanks
The problem in this solution is, that the location of this file are different. WordPress allow the definition of the folder of plugins and themes, different to your static path check for the wp-load.php
.
//*
// Custom content directory
define( 'WP_CONTENT_DIR', dirname( __FILE__ ) . '/wp-content' );
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-content' );
// Custom plugin directory
define( 'WP_PLUGIN_DIR', dirname( __FILE__ ) . '/wp-plugins' );
define( 'WP_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-plugins' );
// Custom mu plugin directory
define( 'WPMU_PLUGIN_DIR', dirname( __FILE__ ) . '/wpmu-plugins' );
define( 'WPMU_PLUGIN_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wpmu-plugins' );
/**/
The follow 3 points are copied form Ottos post. You find also alternatives in this post.
include("../../../wp-load.php");
?? What should I use instead of this ?? Thanks
It is bad because on any security aware wordpress setting you will not be able to directly execute php on any folder except for the root one, which is the situation in which that line of code is usually used.
there is no proper way to do "that", it should never be done.