[wp-trac] [WordPress Trac] #27729: error when wordpress is installed in separate directory then started in site root from function

WordPress Trac noreply at wordpress.org
Wed Apr 9 19:01:40 UTC 2014


#27729: error  when wordpress is installed in separate directory then started in
site root from function
--------------------------+------------------------------
 Reporter:  helened       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.8.1
 Severity:  normal        |  Resolution:
 Keywords:                |     Focuses:
--------------------------+------------------------------

Comment (by jesin):

 Hi Helened,

 Why are you trying to include this file inside the function? Doing this
 will make WordPress execute like this -

 {{{
 function site_startup() {
     //Entire WordPress code
 }
 }}}

 That means the entire scope of WordPress will come into this function.

 From the discussion on PHP's `require()` documentation page -
 http://www.php.net/manual/en/function.require.php#87191

 > require executes the code "as if" it was code written inside of the
 function, inheriting everything including the scope.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/27729#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list