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.

Suppose that we want to implement custom javascript actions to run right after a file has been uploaded. We need to implement wfu_after_file_upload filter.

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

How to Create Custom Filters and Actions for WordPress File Upload Plugin

4 thoughts on “How to Create Custom Filters and Actions for WordPress File Upload Plugin

  • Hello,
    [Sorry for my english, I’m French]
    I’d like add one custom field with a default value but not display it in the upload page.
    I could use Css to hide these field, but I’d prefer do it without indication of these field in the code page.
    Is it possible with the hook system to add code in order to add one “userdata_field” before call the function “wfu_log_action” and like that have one record in the wfu_userdata table with the custom field I’d like to record ?
    I hope I’m clear.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.