I'm trying to make a script that uploads a file to a specific folder in the wordpress installation.

Basically I want to upload to /uploads. However, in order to do this I need to know the server path for the WordPress installation.

How can I get this?


Use wp_upload_dir() for path to uploads, and use get_bloginfo() to get paths to the WP location


You can retrieve the path where Wordpress has been installed to from the ABSPATH constant.

It should be available in your plugin/theme code, it is defined at the very start of wp-load.php.

See also: Using the ABSPATH constant - What files need to be loaded before use?

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.