How do I add recaptcha to a custom form programatically? I'm using the following contrib module: https://www.drupal.org/project/google_recaptcha

How do I add a recaptcha to my form programatically, since the form I'm using isn't listed under forms on the config page of the module?

The following doesn't seem to work:

$form['recaptcha'] = array(
  '#type' =&gt; 'recaptcha'
);
The module doesn't implement hook_element_info, so it doesn't define a new element type. The code you're using looks like it's borrowed from the traditional captcha module, which does things a bit better and provides the element type.

Looking at the code, this is all you need in your form alter hook:

g_add_captcha($form, $form_id);