What is the difference between add_action and add_filter [duplicate]

add_action

add_action is what you use to create a trigger “hook” – when something happens, do-something-else.

add_Filter
add_filter is used to “hook” data change/replace – where there is [some-code], change it to some-other-expanded-code.
add_filter ( string $tag, callable $function_to_add, int $priority = 10, int $accepted_args = 1 )
Hook a function or method to a specific filter action.
WordPress offers filter hooks to allow plugins to modify various types of internal data at runtime.
A plugin can modify data by binding a callback to a filter hook. When the filter is later applied, each bound callback is run in order of priority, and given the opportunity to modify a value by returning a new value.