// Our filter callback function
function example_callback( $string, $arg1, $arg2 ) {
// (maybe) modify $string
return $string;
}
add_filter( 'example_filter', 'example_callback', 10, 3 );
/*
* Apply the filters by calling the 'example_callback' function we
* "hooked" to 'example_filter' using the add_filter() function above.
* - 'example_filter' is the filter hook $tag
* - 'filter me' is the value being filtered
* - $arg1 and $arg2 are the additional arguments passed to the callback.
$value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );
سلام. کد بالا روش استفاده از تابع apply_filters را نشان می دهد. در آدرس زیر می توانید توضیحات بیشتری در رابطه با فیلترهای تعیین شده برای هرکدام از فیلدهای user پیدا کنید. برای مثال برای فیلتر فیلد آی پی مربوط به کاربری که برروی مقاله سایت، کامنت گذاشته است در آدرس زیر توضیحات لازم را داده است.
https://codex.wordpress.org/Plugin_API/Filter_Reference/pre_comment_user_ip