Skip to main content
added 207 characters in body
Source Link
s_ha_dum
  • 65.5k
  • 13
  • 84
  • 174

You must be defining your callback function inside a function that is reused by the widget system-- my guess is inside the widget method.

Define the callback outside the widget itself, and only apply (apply_filter) inside the widget.

In other words, add your callback as class method, and add it something like this:

add_filter('posts_where', array($this,'filter_where'));

You should be able to remove it with a similar syntax.

Without seeing your code in context that is the best I've got.

You must be defining your callback function inside a function that is reused by the widget system-- my guess is inside the widget method.

Define the callback outside the widget itself, and only apply (apply_filter) inside the widget.

Without seeing your code in context that is the best I've got.

You must be defining your callback function inside a function that is reused by the widget system-- my guess is inside the widget method.

Define the callback outside the widget itself, and only apply (apply_filter) inside the widget.

In other words, add your callback as class method, and add it something like this:

add_filter('posts_where', array($this,'filter_where'));

You should be able to remove it with a similar syntax.

Without seeing your code in context that is the best I've got.

Source Link
s_ha_dum
  • 65.5k
  • 13
  • 84
  • 174

You must be defining your callback function inside a function that is reused by the widget system-- my guess is inside the widget method.

Define the callback outside the widget itself, and only apply (apply_filter) inside the widget.

Without seeing your code in context that is the best I've got.