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

I have written few functions in the function.php file of the theme. Should I use add_filter function for those functions?

share|improve this question
Please can you give more details? – sorich87 Jun 18 '12 at 14:04
up vote 1 down vote accepted

It depends on the things you want to do. you can use add_filter and add_action based on what you want to do.

Actions: Actions are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions are executed at these points, using the Action API.

Filters: Filters are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Your plugin can specify that one or more of its PHP functions is executed to modify specific types of text at these times, using the Filter API.

so if you want to modify the content, you should hook using filter functions. For doing your own stuffs, you need to hook using action functions.

if you have explained your purpose, we could probably tell you what you need to use.

More details here: http://codex.wordpress.org/Plugin_API

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.