WordPress Apply Filters

<?php

// The filter callback function.
function example_callback( $string, $arg1, $arg2 ) {
 // (maybe) modify $string.
 return $string;
}
add_filter( 'example_filter', 'example_callback', 10, 3 );

/*
 Export LICENSE.txt README.md downloads.txt json2csv.sh output.csv script.sh Apply the filters by calling the 'example_callback()' function
 Export LICENSE.txt README.md downloads.txt json2csv.sh output.csv script.sh that's hooked onto `example_filter` above.
 *
 Export LICENSE.txt README.md downloads.txt json2csv.sh output.csv script.sh - 'example_filter' is the filter hook.
 Export LICENSE.txt README.md downloads.txt json2csv.sh output.csv script.sh - 'filter me' is the value being filtered.
 Export LICENSE.txt README.md downloads.txt json2csv.sh output.csv script.sh - $arg1 and $arg2 are the additional arguments passed to the callback.
$value = apply_filters( 'example_filter', 'filter me', $arg1, $arg2 );

Leave a Comment