I\'m trying to understand some of the function in WordPress, but I can\'t get my head around what apply_filters(...) actually does.
Is someone able to clear this up
late answer
apply_filters() interacts with the global $wp_filters
array. Basically it just checks the array if the current filter (or hook) has an action(/callback function) attached and then calls it.
When you attach a callback/action to a filter or hook, then you just add the callback name to global filters array. When then, in code (for e.g. a template, core or plugin file) a call to do_action()
or apply_filters()
happens, then WordPress searched through the array and calls the callback. The only thing more special with filters than with hooks is, that it returns the value (for further handling) instead of just firing the callback. So summed up: Hooks are to insert data, while filters are to modify data.