Wordpress-What are hooks and define types of hooks in WordPress?

Hooks are provided by WordPress to allow your plugin to 'hook into' the rest of WordPress, i.e., to call functions in your plugin at specific times, and thereby set your plugin in motion. There are two kinds of hooks:

Actions Hooks: Actions hooks are the hooks that the WordPress core launches at specific points during execution, or when specific events occur. Your plugin can specify that one or more of its PHP functions which are executed at these points, using the Action API.

Filters Hooks: Filters hooks are the hooks that WordPress launches to modify text of various types before adding it to the database or sending it to the browser screen. Your plugin can specify that one or more of its PHP functions which are executed to modify specific types of text at these times, using the Filter API.

Actions Function Examples:
has_action()
add_action()
do_action()
do_action_ref_array()
did_action()
remove_action()
remove_all_actions()

Filter Function Examples:
has_filter()
add_filter()
apply_filters()
apply_filters_ref_array()
current_filter()
merge_filters()
remove_filter()
remove_all_filters()

No comments:

Post a Comment