WordPress Filter Explained
Often confused bits of wordpress are hooks and filters. As the name goes filter are generally related to the content where as hooks are more related to the events.
Filters are used to modify text before adding it to databse or before its been output to the screen.
WordPress filters takes two parameters. The first one being the content we want to modify and second the callback function.
For example fif we add <hr> tag after the content we can do something like:
Here above I am using the anonymous function which is supported in PHP 5.3.0 or above, as its for demo only. In case if your version is older than PHP 5.3.0, you will have to use
callback function. The alternate of above filter will be:
I am Robin - WordPress Developer based in Sydney. I work as Digital Developer. I do some projects now and then, and love blogging about WordPress and Web Design.