Support » Plugin: Contact Form 7 » How to bypass wp-json while keeping jQuery functionality

  • Resolved sylver11

    (@sylver11)


    I have the following situation:

    My website has wp-json disabled. I am actually a fan of the API but there are forces beyond my control that have forced me to do that. Hope that is enough of an explanation.

    Also I have tried to disable jQuery on each site that has a contact form 7 widget with:

    function my_deregister_javascript()
    {
    if ( is_page(‘site-with-form-7’) )
    {
    wp_register_script( ‘jquery’ );
    }
    }

    But that is also not a sustainable solution because I need to have jQuery functionality on each of those sites. Now I was thinking.. can’t I just take the requested json content from my /wp-json and hardcode that into some folder which I will point the request towards?

    Would be amazing if somebody has some feedback on that idea 🙂

    • This topic was modified 3 months, 1 week ago by sylver11.
    • This topic was modified 3 months, 1 week ago by sylver11.
Viewing 1 replies (of 1 total)
  • will answer my own question here:

    What worked for me was to disable js call from CF7 by adding this to the wp-config.php file

    define(‘WPCF7_LOAD_JS’, false);

    This will make your CF7 to default to normal POST request which means page refresh so not the most optimal solution but it works.
    Just remember to not insert it at the very bottom. You will find documentation here:

    https://contactform7.com/controlling-behavior-by-setting-constants/

Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.