What does apply_filters(…) actually do in WordPress?

后端 未结 4 1474
谎友^
谎友^ 2020-12-12 12:13

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

4条回答
  •  春和景丽
    2020-12-12 13:05

    Here's what I'm gleaning, upon considering the most popular answer and additional resources:

    • $tag seems to be a synonym for the name of the hook. (That's not particularly intuitive to me.)
    • the_content is an example of a hook, of the "filter" type.
    • the_content hook consists of multiple filters.
    • Filters modify data. They basically filter the database, changing the data before the users view it.
    • A common use of apply_filters(), for instance, is to apply the_content filters to $content. In this instance, double returns will convert to

      tags, smiley faces will convert to icons, etc.

    • "the_content" is a hook, while "the_content()" is a function.

提交回复
热议问题