WordPress File Upload plugin supports a number of filters and actions to better tailor it to your needs. The full list of filters and actions supported can be found in this article.
Since version 3.6.0 administrators can define custom code to implement these filters right from the plugin’s area in Dashboard, without the need to add 3rd party plugins, as happened before.
To do that we first need to go to the plugin’s area in Dashboard, in Hooks tab and create a new hook like this:
A new screen appears requesting to add a title for the hook, a description, the code, status (activated or not) and where it is supposed to run (in the dashboard or in the front-end). We add some custom title and description.
The plugin provides code templates, shown right above the code box, in order to assist the user implement the filters easily and quickly. We select the option “After File Upload Filter” and we press “Add Code“. The code box is filled with php code of the filter function and comments with instructions that describe how to use the filter, as shown below:
We edit the code so that a success message popups to the user if the file was uploaded successfully. The code finally looks like this:
We set its Status to Active and we Save it.
If everything is Ok, then we will see the new hook in the Hook List in Dashboard as follows, otherwise a message will appear on top with error information and the plugin will not be activated:
We can also activate, deactivate, delete the hook or perform bulk actions on many hooks from this screen.
Now that the filter is set up correctly we attempt to upload a file from a page. When the file is successfully uploaded, the following message is shown on screen:
For more information or questions about the Hooks feature, you can contact us.
The Iptanus Team