[Multisite Privacy] Languages - Change "blog" to "site"

As Wordpress is so much more than a blogging platform would you kindly change the Access Denied messages to use the word "site" rather than "blog".

E.G. on the redirected login screen:
"Authorization Required: this blog may only be viewed by administrators."

This may also raise the issue that the messages are hardcoded in the php file rather than being translatable?

  • Nithin
    • Support Wizard

    Hi Richard Young,

    Hope you are doing good today. :slight_smile:

    All these mentioned text are translatable, and can be translated via PO, and MO files. You can check this article for more info on how to translate that text:
    https://premium.wpmudev.org/blog/how-to-translate-a-wordpress-plugin/

    If you are only looking to specifically change the mentioned text, then you could use the following code:

    <?php
    
    add_filter( 'gettext', 'wpmudev_stewide_change_text', 20, 3 );
    
    function wpmudev_stewide_change_text( $translated_text, $text, $domain ) {
    
            switch ( $translated_text ) {
    
                case '<strong>Authorization Required</strong>: This blog may only be viewed by administrators.' :
    
    			$translated_text = sprintf(__( '%s Authorization Required %s : This site may only be viewed by administrators.', 'sitewide-privacy-options' ), '<strong>', '</strong>' );
    
                    break;
    
            }
    
        return $translated_text;
    }

    The above code should help with translating the mentioned text. You can implement the above code via mu-plugins, please check this article on how to add it as a mu-plugins:
    https://premium.wpmudev.org/manuals/wpmu-manual-2/using-mu-plugins/

    I'll also bring this into our developers attention, so that they could look into the feature of improving the texts as you have mentioned.

    Thanks for submitting feature request, really appreciate. Have a great day ahead. :slight_smile:

    Regards,
    Nithin

  • Richard Young
    • New Recruit

    Thanks, Nithin.
    I found the article helpful and now understand how to use the plugin's .pot file.

    Whilst I created the sitewide-privacy-options-en_US.po and sitewide-privacy-options-en_US.mo (my network's default language) I personally prefer to use the filter within a mu-plugin. The reason? It saves creating every kind of language file for all of the countries and is, of course, more update proof than simply amending the php (providing the developer doesn't change the message coding).

    So all-in-all I've learnt a couple of things with your help. :grinning:

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.