Also, is there some code I can throw in my functions.php file to only load the javascript on certain pages? I only need it to load on the Contact page and WordPress’s register/login/forgot password pages.
Hi, I’m currently trying to implement some more conditionals to scripts inclusion. In the latest github version there are two new filters.
This one will remove the login css (which is loaded only on login pages pages now):
apply_filters('wp_recaptcha_print_login_css','__return_false');
wp_recaptcha_do_scripts
will load the scripts only on login, register and your contact form page. (Don’t forget to fill in the ID of your contact page):
function recaptcha_disable_on_frontend( $enabled ) {
if ( get_the_ID() != CONTACT_FORM_PAGE_ID && ! is_admin() && ! in_array( $GLOBALS['pagenow'], array( 'wp-login.php', 'wp-register.php' ) ) )
return false;
return $enabled;
}
add_filter('wp_recaptcha_do_scripts','recaptcha_disable_on_frontend');
);
I would really appreciate if you test it and give me some feedback, if it works for you.
Ok, I installed the github version and how can I get:
apply_filters('wp_recaptcha_print_login_css','__return_false');
To also return false on the login/register/lost password pages? I don’t want the css to load AT ALL because it’s forcing my form’s width to be too small. I’d rather not edit the plugin’s core files.
Also this is my view source on the register/login pages, it seems to be adding the marked out code twice:
<!-- BEGIN recaptcha, injected by plugin wp-recaptcha-integration -->
<!-- END recaptcha -->
<!-- BEGIN recaptcha, injected by plugin wp-recaptcha-integration -->
<style type="text/css">
#login {
width:350px !important;
}
</style>
<!-- END recaptcha -->
This is my site: http://ow.ly/JVG6V
And your second conditional works perfectly, now the js only loads on my contact page and the login/register/lost password pages…thanks.
v1.1.1 just commited. can close this now.