Я вижу, что вы уже приняли ответ, но вы спрашивали о том, чтобы включить его в функцию, так что вот как. Фильтр gettext
принимает 3 параметра gettext Hook
// Change text strings and make sure you're only on the specic text domain
function dd_change_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Product added!' :
// Make sure you're only using the phrase in the specific text domain you want.
if ($domain == 'yith-woocommerce-wishlist'){
$translated_text = __( 'Something Else','your_text_domain');
} else {
// otherwise use the default text, in case Product addded! is used somewhere else in another text domain
// This is optional
$translated_text = __( 'Product added!', $domain);
}
break;
}
return $translated_text;
}
add_filter( 'gettext', 'dd_change_text_strings', 20, 3 );
Я лично ... Я бы скорее добавил несколько строк кода, чем целый плагин (который, вероятно, добавляет сценарии и css на мой сайт), чтобы сделать то, что может сделать этот маленький фрагмент.