I want to change some (20-30) of the defaults strings on WordPress back-end (not to translate).
I know there is gettext filter but I think could lead to performance issues if we have a lot of strings.
Another method I tried was to create and use an admin-en_US.po file.
Which of the above methods are faster? Is there any better way? What do you suggest without affect performance?
Additionally to kaiser’s answer, you can load customized .mo files that overrides the original file using load_textdomain_mofile
filter. For example:
add_filter( 'load_textdomain_mofile', 'cyb_filter_load_textdomain_mofile', 10, 2 );
function cyb_filter_load_textdomain_mofile( $mofile, $domain ) {
if ( $domain == 'some-textdomain-to-override' ) {
$mofile = WP_LANG_DIR . '/overrides/' . basename( $mofile );
}
return $mofile;
}
It may be faster but you will be required to check for changes on every update in order to keep your .mo file syncrhonized with the original.