Good plugins provide actions and filters to allow others (like you!) to modify some of their functionality without having to either create a whole new plugin from scratch or hack away at the original plugin, losing your changes when that plugin gets updated down the road. Learn how to find these actions and filters in other plugins, and use them to bend the plugin to your will.
15. The Events Calendar
▪ Message to verify location
▪ Venue -> Location
▪ Cost formatting
16. Can’t find the one you need?
▪ (Nicely) ask the developer of the plugin
▪ Direct contact information / website
▪ wordpress.org support forums
▪ Look for a paid support or Pro version
▪ Submit a patch
ACTION
An action is something that is fired at a specific point in time, and basically tells the WordPress world “hey! something's happening right now”.
FILTER
A filter allows you to modify some data or value the plugin is going to use. You can either change parts of a value, or replace it completely, before the plugin actually uses it.
Actions and filters are very similar in their usage.
For an action, a plugin author would call do_action with a unique identifier, and optionally some extra arguments related to the action.
In our code we can then create a call to add_action(), which would call a function we create when this action is fired. The first argument is the same unique identifier used in do_action, and the name of the function we want WordPress to call. Optionally we can specify the priority of our function being called relative to others who are hooking into the same action, and the number of arguments we want to pass into our function from the do_action call.
Filters work by the plugin calling apply_filters, with a unique identifier and the default value or data the plugin wants to use. Optionally extra information can be passed in to help us decide how to change the value, such as the current post ID.
In our code,
Go forth and modify plugins using actions and filters
So what if, after looking for documentation, looking at the code and using the search for HTML technique, you still can’t find a filter or action you can use?
You can (nicely) ask the developer either directly if they provide a website or contact information, or through the support forum on the wordpress.org plugin page, for what you’re looking for. They might add it for you if it doesn’t exist already, or let you know where to find what you’re looking for. Try to be succinct and specific in your request, and remember that often plugins are maintained for free, so you might not hear back anytime soon, if ever.
They may have a paid support or Pro option, which you can find by reading their plugin description or searching the web
Also if possible you can try to submit a patch, or a modification to the original plugin, adding in the action or filter you want to be able to use. It’s up to the author of the plugin to include your patch or not and release it for use.
Go forth and modify plugins using actions and filters