What is filter?

Ernest Marcinko Leave a Comment

Filter is a type of Hook. WordPress provides so called Hooks to developers to access certain points of the program without actually editing the core code. You can “Hook” your own function to a filter. Your function will recieve a number of parameters (usually one), which are defined by the filter. You can do whatever you want to these parameters. After modifying the parameter you can return that value and the next hook to that filter will recieve it with your modification.

A good example is “the_content” filter, which passes one parameter: the content. It’s run on every post,page, custom post type content in WordPress. If you want to print something before/after the content then you should use the “the_content” filter.

Here you can lear more about it.

Latest posts by Ernest Marcinko (see all)