Digamber Pradhan

Remove Action Hooks and Filters defined in classes.

In my previous post, i explained and walked through the process of removing actions from Hooks and Filters.
In this post I will cover how to un-hook action and filters that have been defined in classes.

Firstly lets cover the singleton class a very popular way of defining plugins in WordPress environment.
A singleton class only allows one instance of a class to be created. Singleton.

There are many advantage of using this, one of which is other developers can remove filters you’ve defined in your class. Here is a code example of how:

The more troublesome part is when plugin developers and there are quite a few do not take into account that maybe a user needs to unhook their action or remove their filters, this is quite troublesome. Luckily developers are good at finding loop holes and instead of stealing credit here’s a link to a gist i’ve found most userful.

Exit mobile version