Wrapping my head around add_filter

Filters and Actions are similar under the hood, but with an important difference-

Actions allow you to do something when an event occurs- WordPress does something and executes an action to let you do your own thing. A function hooked to an action may or may not produce output, but it never returns a value

Filters allow you to replace or modify some kind of data. WordPress has some data it is using in a function, but before it is used, it applies a filter to that value to let you change it. It’s generally safe to say that a filter will return something.

I can take any function in the core files, pass this as the filter name, and the second argument I can replace this with my own function in the functions.php or plugin file.

You can’t arbitrarily select a function name and add a filter to it, though as you’ve discovered, this may seem to be the case because WordPress has conveniently named many actions to match the function names that contain those actions.

You can only add a filter where the code contains a call to apply_filters hooked to that tag.

You can only add an action where the code contains a call to do_actions hooked to that tag.