WordPress 中文文档
Function Reference/add filter
From WordPress Chinese
目录 |
Description
Hooks a function to a specific filter action.
Filters 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. Plugins can specify that one or more of its PHP functions is executed to modify specific types of text at these times, using the Filter API. See the Plugin API for a list of filter hooks.
Usage
%%% <?php add_filter($tag, $function_to_add, $priority = 10, $accepted_args = 1); ?> %%%
Parameters
Template:Parameter Template:Parameter Template:Parameter Template:Parameter
Return
true if the $function_to_add is added successfully to filter $tag. How many arguments your function takes. In WordPress 1.5.1+, hooked functions can take extra arguments that are set when the matching do_action() or apply_filters() call is run. For example, the action comment_id_not_found will pass any functions that hook onto it the ID of the requested comment.
