Put is_page()
inside the callback function:
function include_regForm_validation() {
wp_register_script( 'jQuery_form_validation', 'https://cdnjs.cloudflare.com/ajax/libs/jquery-validate/1.17.0/jquery.validate.js',array('jquery'), '1.0', true );
if ( is_page( 'login' ) ) {
wp_enqueue_script( 'jQuery_form_validation');
}
}
add_action( 'wp_enqueue_scripts', 'include_regForm_validation' );
WordPress has not determined what page/archive has been requested yet when hooks are added with add_action()
, so you need to make the determination only when wp_enqueue_scripts
actually runs, which you do by putting the check into your hooked function.