I am attempting to understand a few of the function in WordPress, however i can't get my mind around what apply_filters(...) really does.

Is someone in a position to obvious this up for me personally having a couple of good examples?

apply_filters($tag, $value) passes the 'value' argument to each one of the functions 'hooked' (using add_filter) in to the specified filter 'tag'. Each function works some processing around the value and returns an altered value to become passed to another function within the sequence.

For instance, automatically (in Wordpress 2.9) the the_content filter passes the worthiness with the following sequence of functions:

  • wptexturize
  • convert_smilies
  • convert_chars
  • wpautop
  • shortcode_unautop
  • prepend_attachment
  • do_shortcode

Some tips about what I am gleaning, upon thinking about typically the most popular answer and extra assets:

  • $tag appears to become a synonym for that title from the hook. (That isn't particularly intuitive in my experience.)
  • the_submissions are one particualr hook, from the "filter" type.
  • the_content hook includes multiple filters.
  • Filters modify data. They essentially filter the database, altering the information prior to the customers notice.
  • A typical utilization of apply_filters(), for example, is with the_content filters to $content. In cases like this, double returns will become <p> tags, smiley faces will become symbols, etc.
  • "the_content" is really a hook, while "the_content()" is really a function.

Within the most fundamental terms, apply_filters can be used to initialise a filter hook... add_filter assigns a brand new function to hooks that happen to be produced.