You better off using a translator, thats what i used WP Override Translations. It changes all the names i need site wide
Add this snippet to your site for the purpose-
function wcfm_custom_0308_translate_text( $translated ) {
$translated = str_ireplace( 'Product', 'Exam', $translated );
$translated = str_ireplace( 'product', 'exam', $translated );
$translated = str_ireplace( 'Vendor', 'Teacher', $translated );
$translated = str_ireplace( 'vendor', 'teacher', $translated );
return $translated;
}
add_filter('gettext', 'wcfm_custom_0308_translate_text');
add_filter('ngettext', 'wcfm_custom_0308_translate_text');
Add custom code(s) to your child theme’s functions.php
In case you do not have child theme then add those using this plugin – https://wordpress.org/plugins/code-snippets/