I made simple class plugin to test upload capacity in a personnalized directory. After a search i came to this : http://pastebin.com/RkpZ9vKh But as you can see if i call add_filter from within the class :
add_filter('upload_dir', array(&$this, 'myplug_upload_dir_inside'));
my upload is done to the standard directory
But if i use the add_filter from outside the class, the upload is correctly directed to where i expected. The problem here is this filter is then available to all pages : when i then upload from the Library, the file is set to the new directory too.
How to make this filter have a limited action to this plugin / page using my code structure ?
- The topic ‘Problem of use of add_filter within a class plugin’ is closed to new replies.