Home › Forums › Product Support Forums › Ajax Search Pro for WordPress Support › Plugin incorrectly references uploads directory
This topic contains 3 replies, has 2 voices, and was last updated by Ernest Marcinko 5 years ago.
- AuthorPosts
- March 7, 2018 at 12:27 am #17032
On websites where WordPress is run in it’s own directory and the upload directory is outside of this directory, the call to
wd_asp()->upload_path
on line on line 441 of wp-content/plugins/ajax-search-pro/includes/classes/core/class-asp-init.php incorrectly returns the path of the uploads directory as if it still was in the wordpress directory. E.g.
Directory structure
- wordpress (contains WordPress installation)
- uploads (uploads directory)
The call to
wd_asp()->upload_path
returns wordpress/uploads but should return uploads.
March 7, 2018 at 11:54 am #17037Hi!
That constant is defined in the ajax-search-pro\includes\classes\core\class-asp-manager.php file within this function:
As you can see the upload directory is requested through wp_upload_dir() call, which refers _wp_uploads_dir(), and should always return the correct upload directory.
Is this not the correct way? Please let me know, I am not too familiar with these modifications myself.
Also, from what I can see in these docs, if the UPLOADS constant is set in the wp-config.php file, the wp_upload_dir() will return that url relative to the ABSPATH constant. You might need to set that constant as well, I am not sure.
Let me know!
Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
March 8, 2018 at 8:45 pm #17046Hi Ernest,
Thanks for your quick response and for looking into this for me. You’re quite right, the UPLOADS constant ends up being prefixed with ABSPATH- that’s something I hadn’t noticed and unfortunately something I can’t change without modifying the core.
A workaround I have now found is to set the UPLOADS constant to “../media”. Although this does generate links like e.g. http://domain.com/../media/mypicture.jpg this is not serious in my case.
You can close this ticket as the issue is now resolved.
Thanks again,
Oli
March 8, 2018 at 9:41 pm #17047You cannot access this content. Best,
Ernest Marcinko
If you like my products, don't forget to rate them on codecanyon :)
- AuthorPosts
You must be logged in to reply to this topic.