Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the hueman domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /var/www/CloudIngenium.com/htdocs/wp-includes/functions.php on line 6114
WordPress MultiSite: Remove render-blocking JavaScript: http://[parent-domain]/?dm=[random-string]&action=load&blogid=[Blog-Numer]&siteid=1&t=[A-Time?]&back=[source-page] – Knowledge eXchange

WordPress MultiSite: Remove render-blocking JavaScript: http://[parent-domain]/?dm=[random-string]&action=load&blogid=[Blog-Numer]&siteid=1&t=[A-Time?]&back=[source-page]

WordPress MultiSite: Remove render-blocking JavaScript: script src=’http://[parent-domain]/?dm=[random-string]&action=load&blogid=[Blog-Numer]&siteid=1&t=[A-Time?]&back=[source-page] type=’text/javascript’

So this is the latest in the “I want to improve my Google´s PageSpeed” saga. I was running Google’s PageSpeed to determine what fixes I need to implement on my site to get a higher ranking and hopefully improve the rank it gives to my site. One of the key aspects it shows is that there is a render-blocking JavaScript being executed. Further inquiry revealed the following script being executed on every single page:

<script src='http://[parent-domain]/?dm=[random-string]&amp;action=load&amp;blogid=[Blog-Numer]&amp;siteid=1&amp;t=[A-Time?]&amp;back=[source-page] type='text/javascript'>

At this point I have absolutely no clue where this is coming from. Searching for “?dm=” yielded only references to multisite and I figured this had to do with the Cache I had recently implemented so I completely dismissed it. However, it turns out this is in fact a script added by the “WordPress MU Domain Mapping” plugin that is supposed to help with the remote login to a site… although effectively what it is doing is loading the homepage on every page which seems unnecessary and google keeps complaining about this script so I figured I would remove it.

There are two things you could do at this point:

  1. Edit the code for the plugin to adjust its functionality: Create an asynchronous JavaScript or whatever improvement you could think of. I believe this is located at the head and the script is referenced as “‘remote_login_js_loader'” found in wp-content/plugins/wordpress-mu-domain-mapping/ around line 672.
  2. Disable Remote Login. In Network Admin > Settings > Domain Mapping > Domain Options, uncheck Remote Login. That should remove this script from being added.

I am still not sure how this cross-domain login support is really supposed to work. For now I have only disabled the functionality via option 2 but if it turns out I do need this functionality I might have to look further into option 1 and probably just go for the asynchronous JavaScript method.

UPDATE:

I figured out what this actually does! Well, sort of. I figured out what I lose if I unselect Remote Login: When you visit one of your sites that is not in the same domain name of your root site you don’t get automatically logged in. So, you don’t get the fancy WordPress bar at the top, etc. So here is the code I used. I only added the keywoard async to line 777 to indicate that the script should be loaded asynchronously and boom! solved I think.
function remote_login_js_loader() {  global $current_site, $current_blog;

if ( 0 == get_site_option( 'dm_remote_login' ) || is_user_logged_in() )   return false;

$protocol = is_ssl() ? 'https://' : 'http://';

$hash = get_dm_hash();

echo "<script src='{$protocol}{$current_site->domain}{$current_site->path}?dm={$hash}&amp;action=load&amp;blogid={$current_blog->blog_id}&amp;siteid={$current_blog->site_id}&amp;t=" . mt_rand() . "&amp;back=" . urlencode( $protocol . $current_blog->domain . $_SERVER[ 'REQUEST_URI' ] ) . "' type='text/javascript' async /script";> }

You may also like...

1 Response

  1. Matt says:

    Thanks, this solved a problem i had been working on for over a day

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.