• feanorknd

    (@feanorknd)


    Hello:

    Pagespeed focus on block rendering… if using any optimizing plugins as autooptimize, may add recaptcha as whitelisted if you want it to run without problems…

    So I needed to async or defer its load, excluding js from autooptimize as well..

    Just edit functions.php

    /************************************************************************
    /* A?ADIENDO ASYNC A RECAPTCHA PARA PAGESPEED
    /************************************************************************
    * https://matthewhorne.me/defer-async-wordpress-scripts/
    *************************************************************************/
    function add_async_attribute($tag, $handle) {
    if ( ‘google-recaptcha’ !== $handle )
    return $tag;
    return str_replace( ‘ src’, ‘ async=”async” src’, $tag );
    }
    add_filter(‘script_loader_tag’, ‘add_async_attribute’, 10, 2);
    /************************************************************************/

    that is all… script async load, and no rendering blocks..

    Please developer, consider this.

    Thanks.

  • The topic ‘Recaptcha Google Api script causing blocks at rendering’ is closed to new replies.