For instance, somewhere, in the wordpress core files or in the theme files can be defined a function like this:
function output_some_text($text){ echo apply_filters('output_text_i_want', $text); }
…and in some other places is this function called like this:
output_some_text('Welcome!');
So, you would like to change this output in some certain cases, let’s say, only if administrator has logged in, but you don’t want to change an original function, what is of course reasonable. Now you can use add_filter() function in your child theme functions.php file and hook it into applied filter like this:
add_filter('output_text_i_want', 'my_new_text_for_admin');
function my_new_text_for_admin($text){
if(current_user_can('administrator')){
$text = 'Hi, admin!';
}
return $text;
}
So, now logged in admin user can see on the page text “Hi, admin!”.
Thanks to: http://dev.themeblvd.com/tutorial/filters/