Difference between WordPress Actions and Filters ?

@mit $ingh. March 06, 2018 Comments

What makes WordPress stands out as one of the most popular CMS ecosystems is the extendibility of its core code. Any WordPress developer can modify the behaviour of WordPress or even add as many features as she can, without touching the core code of WordPress. This is thanks to WordPress hooks.

WordPress hooks are pre-defined points in the WordPress core code where developers can use them to inject an additional code or modify a variable. WordPress hooks have two types of hooks, Actions and Filters.

WordPress Actions

WordPress actions are benchmarks where the developer need to execute a specific code at a specific event. For instance, if a developer wants to make WordPress publish the post to social networks at the same moment the administrator publish the post. He only needs to add the publishing code to the pre-defined action save_post. Luckily, WordPress has a very comprehensive documentation. Hence, most of the hooks are well documented with usage examples.

 

https://wpruby.com/wordpress-what-is-the-difference-between-actions-and-filters/

  • PHP
  • wordpress
  • add_action
  • add_filter