I just want to know what is the difference between the add_action and add_filter. I just could not get it enough in the documentation of wordpress. Can anyone explain it more broader and simpler. Thank you in advance.
This question already has answers here: Difference Between Filter and Action Hooks? (4 answers) Closed 5 years ago.I just want to know what is the difference between the add_action and add_filter. I just could not get it enough in the documentation of wordpress. Can anyone explain it more broader and simpler. Thank you in advance.
Share Improve this question edited Sep 25, 2019 at 16:46 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked Sep 25, 2019 at 7:53 Lucifer LeviLucifer Levi 932 silver badges11 bronze badges 01 Answer
Reset to default 4add_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.