What’s the difference between filters and actions?

[ad_1]

Hi, I've been getting into plugin development. I was reading about filters and actions in the wordpress documentation and to me it seemed like they were basically the same. I got curious and looked into wordpress core code, and surprisingly I was right:

function add_action( $tag, $function_to_add, $priority = 10, $accepted_args = 1 ) {  
    return add_filter( $tag, $function_to_add, $priority, $accepted_args );
}

So, the add_action fuction basically just calls the add_filter function with the same arguments!

So my question is, is the difference between them merely a matter of semantics? Because to me it seems any thing that can be done with one can be done with the other one. Where should I use actions and where should I use filters, is there some guidline?

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer