Access our premium support and let us know your problems, we will help you solve them.

0
No products in the cart.

Forum Replies Created

Viewing 1 post (of 1 total)
  • Author
    Posts
  • in reply to: Retrieve WordPress root directory path? #9944
    blanknick-surmanidze
    Participant

    For retrieving the path you can use a function <?php $path = get_home_path(); ?>. I do not want to just repeat what had been already said here, but I want to add one more thing:

    If you are using windows server, which is rare case for WordPress installation, but still happens sometimes, you might face a problem with the path output. It might miss a “\” somewhere and you will get an error if you will be using such a path. So when outputting make sure to sanitize the path:

    <?php 
    
    $path = get_home_path(); 
    $path = wp_normalize_path ($path);
    
    // now $path is ready to be used :)
    
    ?>
    
Viewing 1 post (of 1 total)