Someone using my plugin/theme surprised me by making their site address different than their install address with the "Enter the address here if you want your site homepage to be different from the directory you installed WordPress." option.


They've installed at:

www . thesite . com / blog /

And their actual wordpress site shows up at

www . thesite . com

Which function properly delivers the filepath (not URL) leading to www . thesite . com ? I have a unique case where this is needed.

Considering random cases, it would have to work if a user chooses www . thesite . com / random / location /


If the site as a whole was installed at www . thesite . com / blog virtually every URL and *file*path is relative to that location. BUT if they modify their settings so that the blog is shown at a different spot OTHER than the install director ( such as www . thesite .com OR www . thesite . com / somerandom / chosen / url ) what I need is the FILE PATH to that location.

REASON: I have a network of sites running, and the plugin installs certain network oriented files at their "home" location.


I recommend reading up on the site_url() function. Take a look here: http://codex.wordpress.org/Function_Reference/site_url and specifically, read the difference between:

site_url() & home_url()

Then you could look at parse_url() or ABSPATH as suggested before by @NickJAB

  • I'm probably not explaining things properly. I'll update the question for clarity Sep 4 '13 at 4:11

If I understand your question right, you are looking for the absolute path to Wordpress. ABSPATH is a constant defined in the wp-config.php file that you may be able to use for this purpose. You can see it by:

<?php echo ABSPATH; ?>

I think they actually moved their main wordpress index.php and .htaccess files from www.thesite.com/blog to www.thesite.com root.

And changing is been made to index.php

Edit on index.php file:





Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.