WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Hey guys, I'm using a calendar plugin that provides a sidebar widget to show current calendar dates.

However this widget always shows N/A if I don't set a category for a specific event. Any idea how I could add a filter to that widget and match N/A and remove it?

thank you for your help

share|improve this question
up vote 2 down vote accepted

In the method "widget" look for the line that sets the category then add either:

$cat = empty($instance['cat']) ? 'N/A' : $instance['cat'];

(where you replace N/A with something you like) or... better... add a filter instead like this:

$cat = apply_filters( 'widget_my_cat', empty($instance['cat']) ? 'N/A' : $instance['cat'], $instance, $this->id_base);

And then hook into 'widget_my_cat' to set it to something else if the value is 'N/A'

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.