I was trying to edit my wordpress site name and description, I got that I have to add a filter plugin like so: add_filter( 'bloginfo', 'My_function_name', 10, 2 );
.
It works, but I can't understand why we have to add the 10, 2
parameters? and which values it belongs to?
Also there wasn't enough information in codex.wordpress.org
Here is my working plugin :
function edit_bloginfo($text,$show ){
if (isset($_COOKIE['switch_language'])) {
if($show == 'description'){
$text = 'New description';
}
if($show == 'name'){
$text = 'New site name';
}
return $text;
}
}
add_filter( 'bloginfo', 'edit_bloginfo', 10, 2 );
In
add_filter( 'filter_hook', 'your_function', 10, 2 );
expression, the10, 2
parameters are:Take a look to WordPress Codex Plugin API
Hope it helps!