I was trying to figure out how to get the absolute directory of an attachment post in WordPress. Turns out there’s no easy function that can give you one, but there is one called wp_upload_dir which will give you an array of the upload directories and URLs. So here’s the secret sauce: $url = wp_get_attachment_url( $post_ID ); $uploads = wp_upload_dir(); $file_path = str_replace(...