How can I change the label “Comments” to “Review” everywhere in the WP installation without translation

You can try the gettext filter.

According to the Codex:

This filter hook is applied to the translated text by the
internationalization functions (__(), _e(), _x(), etc.). This filter
is always applied even if internationalization is not in effect, and
if the text domain has not been loaded.

Here’s an example:

function custom_gettext( $translated_text, $untranslated_text, $domain )
{       
    if( FALSE !== stripos( $untranslated_text, 'comment' ) )
    {
            $translated_text = str_ireplace( 'Comment', 'Review', $untranslated_text ) ;
    }
    return $translated_text;
}

is_admin() && add_filter( 'gettext', 'custom_gettext', 99, 3 );

to change the strings containing Comment to Review (ignoring case).

You can adjust the replacements to your needs.

Leave a Comment