• The_Hegemon

    (@the_hegemon)


    For security and optimization reasons I created a subdomain for wp-content called content.sitename.com.
    My quesion now is: how do call wp-load.php in an PHP file on this subdomain?

Viewing 7 replies - 1 through 7 (of 7 total)
  • Keith Driscoll

    (@keithdriscoll)

    As long as you know the exact location of wp-load.php you could just include it in your scripts.

    However, you may want to take a look at this article by Otto:

    https://ottopress.com/2010/dont-include-wp-load-please/

    Thread Starter The_Hegemon

    (@the_hegemon)

    What do you mean by exact location? The absolute or relative path? Or can it even be on an external domain?

    Keith Driscoll

    (@keithdriscoll)

    Never tried. It would most likely require a bit of hacking.

    However you can put or rename wp-content to whatever you like by adding something like this to your wp-config.php file:

    define ('WP_CONTENT_DIR','/full/path/to/your/content/dir');
    define ('WP_CONTENT_URL','https://example.com/full/path/to/your/content/dirs/url');
    Thread Starter The_Hegemon

    (@the_hegemon)

    Already defined it in wp-config but it still doesn’t work with wp-load.

    Keith Driscoll

    (@keithdriscoll)

    Are you sure they are defined correctly? WP_CONTENT_DIR must be the full path and no trailing slash and WP_CONTENT_URL must be the full URL.

    You shouldn’t need to worry about wp-load.php because it’s already being loaded if wp-config.php is firing off.

    Thread Starter The_Hegemon

    (@the_hegemon)

    Check. Check.
    Still doesn’t work. Everytime wp-load is called from a php file on the subdomain it just redirects me back to the main domain. It’s like everything above wp-content (root directory) is “non-existent”.

    Thread Starter The_Hegemon

    (@the_hegemon)

    By the way: I also tried change the content directory and domain with a fresh install. Still doesn’t work. Could this be a hosting or PHP problem?

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Cant call wp-load.php in file on subdomain’ is closed to new replies.