Difference between do_action, add_action and add_filter

April 27th, 2020 admin 300 Views 0 Uncategorised1 minute, 12 seconds

do_action();

It is used to execute the specific function hooked on a add_action in WordPress core or in your theme or plugin. The function is same like echo. It will display the output of add_action.

add_action();

Function is used to hook a specific action in WordPress. You can add n number of action in WordPress theme and plugin but you cannot use same action cannot be written twice if same add_action it will give you error.

add_filter();

Add filter function is used to override the add_action hook for example if the add action is to display name A and you need to change it to B without removing the add_action then it can be achieved through add_filter(); in the add_filter you need to add the function for converting to B and added into add_filter.

About The Author

admin

Leave Your Thoughts Here...

We are glad you have chosen to leave a comment. Please keep in mind that comments are moderated according to our comment policy.

Name *
Comment

We are glad you have chosen to leave a comment. Please keep in mind that comments are moderated according to our comment policy.