• Resolved payal7

    (@payal7)


    Hi,

    There should be a option in network to set default values of reCaptcha v3 i.e. site key & secret key. I have multisite installation and want to set those keys in my network site only and all sub domains should use keys from network rather than settings those keys in each site.

    Thanks!

Viewing 1 replies (of 1 total)
  • Thread Starter payal7

    (@payal7)

    I found solution in case someone is looking for same.

    add_filter( ‘option_wpcf7’, ‘network_wpcf7_options’, 9 );
    function network_wpcf7_options( $value ) {

    // If we’re not on a multisite setup or contact form 7 isn’t active or we’re on network site, skip this filter hook.
    if ( ! is_multisite() || empty( $value ) || 1 === get_current_blog_id() ) {
    return $value;
    }

    // Grab Network Option.
    remove_filter( ‘option_wpcf7’, ‘network_wpcf7_options’, 9 );
    $network_wpcf7 = get_blog_option( 1, ‘wpcf7’ ); // wpcf7 options from Network site(site id = 1).

    // Configure reCaptcha keys in current site(sub domain) from network site.
    if ( empty( $value[‘recaptcha’] ) && ! empty( $network_wpcf7[‘recaptcha’] ) ) {
    $value[‘recaptcha’] = $network_wpcf7[‘recaptcha’];
    }

    add_filter( ‘option_wpcf7’, ‘network_wpcf7_options’, 9 );
    return $value;
    }

Viewing 1 replies (of 1 total)
  • The topic ‘Retrieve recaptcha v3 key from network (multisite)’ is closed to new replies.