Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
517 views
in Technique[技术] by (71.8m points)

function - What does apply_filters(...) actually do in WordPress?

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 for me with a few examples?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

apply_filters($tag, $value) passes the 'value' argument to each of the functions 'hooked' (using add_filter) into the specified filter 'tag'. Each function performs some processing on the value and returns a modified value to be passed to the next function in the sequence.

For example, by default (in WordPress 2.9) the the_content filter passes the value through the following sequence of functions:

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...