Page MenuHomeSoftware Heritage

recaptcha javascript is loaded on every page
Closed, MigratedEdits Locked

Description

It should only be loaded when needed (only the contact form afaik)

Revisions and Commits

Event Timeline

vlorentz triaged this task as Normal priority.May 27 2020, 12:24 AM
vlorentz created this task.

This seems to be the standard behavior when the Contact form plugin is used on a WP site.

Currently digging in this thread to find a way to activate it only when needed as I agree it is
quite intrusive to have the recaptcha javascript code loaded on each page.

Ok, found a way by executing this in functions.php from our custom WP theme.

// load Google Recaptcha v3 only when required
add_action('wp_print_scripts', function () {
  if (!is_page(array('contact'))) {
    wp_dequeue_script('google-recaptcha');
  }
});
anlambert closed this task as Resolved by committing Restricted Diffusion Commit.May 27 2020, 6:42 PM
anlambert claimed this task.
anlambert added a commit: Restricted Diffusion Commit.
anlambert mentioned this in Unknown Object (Maniphest Task).Jan 5 2021, 4:28 PM