Plugin is loading recaptcha on every page causing TBT problems with CWV
-
Hi guys,
I was looking into a TBT problem on my site and found that your plugin is enqueueing the recaptcha js on every page, despite a comment in the code saying it shouldn’t. In
recaptcha-woo.php
line 56// Enqueue recaptcha script only on account or checkout page
add_action("wp_enqueue_scripts", "rcfwc_script_enqueue");
function rcfwc_script_enqueue() {
wp_enqueue_script( 'rcfwc-js', plugins_url( '/js/rcfwc.js', __FILE__ ), array('jquery'), '1.0', array('strategy' => 'defer'));
wp_enqueue_script( 'recaptcha', 'https://www.google.com/recaptcha/api.js?explicit&hl=' . get_locale(), array(), null, array('strategy' => 'defer'));
}
add_action("wp_enqueue_scripts", "rcfwc_script");
function rcfwc_script() {
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
if ( is_checkout() || is_account_page() ) {
rcfwc_script_enqueue();
}
}
}
// Enqueue recaptcha script on login
add_action("login_enqueue_scripts", "rcfwc_script_login");
function rcfwc_script_login() {
rcfwc_script_enqueue();
}Simply commenting out the first
add_action("wp_enqueue_scripts", "rcfwc_script_enqueue");
seems to do the trick.Can we get a fix for this in the plugin?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- You must be logged in to reply to this topic.