I am learning WordPress plugin/theme development and often see both add_action() and add_filter() used to hook into WordPress.
I understand that both are used with hooks, but I am confused about:
What is the actual difference between add_action and add_filter?
When should I use an action instead of a filter?
Can a filter be used like an action (or vice versa)?
Are there any best practices or real-world examples that clearly show the difference?