[wp-trac] [WordPress Trac] #11120: Issue with ABSPATH already defined

WordPress Trac wp-trac at lists.automattic.com
Wed Nov 11 05:16:15 UTC 2009


#11120: Issue with ABSPATH already defined
--------------------------+-------------------------------------------------
 Reporter:  ontic         |       Owner:            
     Type:  defect (bug)  |      Status:  new       
 Priority:  normal        |   Milestone:  Unassigned
Component:  General       |     Version:  2.8.5     
 Severity:  normal        |    Keywords:            
--------------------------+-------------------------------------------------
 A recent project of mine involved using Ajax and I noticed a problem when
 trying to include a couple of files.

 "wordpress/wp-admin/admin.php"
 "wordpress/wp-load.php"

 I was acquiring the location of ABSPATH manually because the file I was
 working with had no involvement with any Wordpress files. Below is an
 example of how I was calculating the correct location.

 "$path = rtrim(dirname(dirname(dirname(__FILE__))), '/').'/';"

 So this enabled me to "require_once" the "admin.php" file. It was not
 necessary to include the "wp-load.php" file because "admin.php" does that
 itself.

 Inside the file "admin.php" it includes the "wp-load.php" file like so.

 if ( defined('ABSPATH') )
     require_once(ABSPATH . 'wp-load.php');
 else
     require_once('../wp-load.php');

 In my case "wp-load.php" cannot be included because it has no idea of its
 location. When I tried defining ABSPATH myself, I then encounter another
 problem. Which can be overcome, by checking whether ABSPATH has already
 been defined in the file "wp-load.php" please see the attached patch.

 Regards,
 Adam

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/11120>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list