Method by which plugins and themes extend core WordPress functionality.
There are two types of hooks that your plugins and themes can use:
- Actions: These hooks allow for execution of your functions during specific events such as when a post is saved, or an attachment is deleted - actions
Plugin API/Action Reference « WordPress Codex - Filters : These hooks alter text during specific events, such as prior to the content being displayed, or prior to post data being updated - filters
Plugin API/Filter Reference « WordPress Codex
An example of adding a filter to enable an extra TinyMCE button:
// add horizontal rule button
function enable_more_buttons($buttons) {
$buttons[] = 'hr';
return $buttons;
}
add_filter('mce_buttons', 'enable_more_buttons');
The filter being hooked onto is mce_buttons
, the callback function is enable_more_buttons
, defined above. This function will now run whenever the mce_buttons
hook (used to build the primary toolbar in the WYSIWYG editor) is triggered.