wp plugin -11
apply_filters( $tag, $value );
$tag — The name of the filter hook.
$value — The parameter passed to any filters added to the hook. The function can also take in any number of extra parameters to pass to filters.
add_filter( $tag, $function, $priority, $accepted_args );
$tag — The name of the hook you want to register your filter for.
$function — The function name of the filter that you create to manipulate the output.
$priority — An integer that represents in what order your fi lter should be applied. If no value is added, it defaults to 10.
$accepted_args — The number of parameters your filter function can accept. By default this is 1 . Your function must accept at least one parameter, which will be returned.
< ?php
apply_filters( ‘wp_title’, $title, $sep, $seplocation );
add_filter( ‘wp_title’, ‘boj_add_site_name_to_title’, 10, 2 );
function boj_add_site_name_to_title( $title, $sep ) {
/* Get the site name. */
$name = get_bloginfo( ‘name’ );
/* Append the name to the $title variable. */
$title .= $sep . ‘ ‘ . $name;
/* Return the title. */
return $title;
}
? >
浙公网安备 33010602011771号