{"id":11679131,"date":"2019-06-27T15:08:07","date_gmt":"2019-06-27T15:08:07","guid":{"rendered":"https:\/\/wordpress.org\/support\/topic\/wp-load-php\/"},"modified":"2019-06-27T15:08:07","modified_gmt":"2019-06-27T15:08:07","slug":"wp-load-php","status":"publish","type":"topic","link":"https:\/\/wordpress.org\/support\/topic\/wp-load-php\/","title":{"rendered":"wp-load.php"},"content":{"rendered":"<p>Your ajax script loads wp-load.php with this statement:<br \/>\nrequire_once ( dirname( dirname( dirname( dirname( __FILE__ ) ) ) ) . &#8216;\/wp-load.php&#8217; );<br \/>\nThis fails if wp-content\/plugins has been moved to a non-standard location.  I&#8217;ve extracted a few lines from the settings table to illustrate our set up below:<br \/>\nABSPATH\tWP absolute path.\t\/home\/lamp\/wordpress\/core\/wp5.2.1\/<br \/>\nWPPA_ABSPATH\tABSPATH windows proof\t\/home\/lamp\/wordpress\/core\/wp5.2.1\/<br \/>\nWPPA_PATH\tPath to plugins directory.\t\/home\/lamp\/wordpress\/wp-content\/www.otu.asn.au\/plugins\/wp-photo-album-plus<br \/>\nWPPA_NAME\tPlugins directory name.\twp-photo-album-plus<br \/>\nWPPA_URL\tPlugins directory URL.\thttps:\/\/www.otu.asn.au\/wp-content\/plugins\/wp-photo-album-plus<br \/>\nWPPA_UPLOAD\tThe relative upload directory.\twp-content\/www.otu.asn.au\/uploads<br \/>\nWPPA_UPLOAD_PATH\tThe upload directory path.\t\/home\/lamp\/wordpress\/core\/wp5.2.1\/wp-content\/www.otu.asn.au\/uploads\/wppa<\/p>\n<p>If I replace the above line with<br \/>\nrequire_once ( &#8216;\/home\/lamp\/webroot\/otu\/wp-load.php&#8217; );<br \/>\nand in wp-config I add:<br \/>\ndefine(&#8216;WPPA_REL_UPLOADS_PATH&#8217;, &#8216;wp-content\/www.otu.asn.au\/uploads&#8217;);<br \/>\ndefine(&#8216;WPPA_REL_DEPOT_PATH&#8217;, &#8216;wp-content\/www.otu.asn.au&#8217;);<br \/>\nThen everything works.<br \/>\nSo you do have support for moving wp-content\/uploads but not support for moving the plugins directory.<\/p>\n<p>Our set up works with these redirects:<br \/>\n\tRewriteCond %{REQUEST_URI} !^\/wp-content\/www.otu.asn.au\/(.*)<br \/>\n\tRewriteCond %{REQUEST_URI} ^\/wp-content\/(.*)<br \/>\n\tRewriteRule ^\/wp-content\/(.*) \/wp-content\/%{SERVER_NAME}\/%1<\/p>\n<p>We have a large number of small WP websites sharing a server. They share WP core code and some common\/large plugins. All this optimises use of OPCache memory.<\/p>\n","protected":false},"template":"","class_list":["post-11679131","topic","type-topic","status-publish","hentry","topic-tag-plugins-directory","topic-tag-wp-load-php"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11679131","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/topic\/11679131\/revisions"}],"wp:attachment":[{"href":"https:\/\/wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=11679131"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}