• Resolved neubi

    (@neubi)


    I have several forms on the website im working on at the moment. There is one very strange error: All the forms only work properly when i’m logged in the WP Backend. Trying to submit any of theses forms not beeing logged in simply does nothing.

    I have no idea what i can do – can anyone of the specialist here help me please?

    Regards
    Rainer

    It seems to be a problem with the RestAPI – there is an error 401 when trying to send:

    POST https://www.dentalmedizin-langweid.de/wp-json/contact-form-7/v1/contact-forms/1665/feedback 401
    send @ jquery.js?ver=1.12.4-wp:4
    ajax @ jquery.js?ver=1.12.4-wp:4
    wpcf7.submit @ scripts.js?ver=5.3:295
    (anonymous) @ scripts.js?ver=5.3:58
    dispatch @ jquery.js?ver=1.12.4-wp:3
    r.handle @ jquery.js?ver=1.12.4-wp:3

    • This topic was modified 3 years, 11 months ago by neubi.
    • This topic was modified 3 years, 11 months ago by neubi.

    The page I need help with: [log in to see the link]

Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    What other plugins and theme do you use on the site?

    Thread Starter neubi

    (@neubi)

    I have the same problem on various sites i made… When trying to send with not beeing logged in theres always that 401 error.

    In the website i mentioned the moment the following plugins are active at the moment:

    Akismet Anti-Spam
    Version 4.1.7 | Von Automattic | Details ansehen

    Contact Form 7
    Version 5.3 | Von Takayuki Miyoshi | Details ansehen

    Contact Form 7 Multi-Step Forms
    Version 4.0.9 | Von Webhead LLC. | Details ansehen

    Cookiebot | GDPR/CCPA Compliant Cookie Consent and Control
    Version 3.9.0 | Von Cybot A/S | Details ansehen

    Elementor
    Version 3.0.14 | Von Elementor.com | Details ansehen | Dokumente und FAQs | Video-Tutorials

    GA Google Analytics
    Version 20201120 | Von Jeff Starr | Details ansehen | Homepage | Rate this plugin ?

    InfiniteWP – Client
    Version 1.9.4.7 | Von Revmakx | Details ansehen | View activation key

    JetBlocks For Elementor
    Version 1.2.6 | Von Crocoblock | Plugin-Seite aufrufen | View details

    JetElements For Elementor
    Version 2.5.2 | Von Crocoblock | Plugin-Seite aufrufen | View details

    JetTabs For Elementor
    Version 2.1.10 | Von Crocoblock | Plugin-Seite aufrufen | View details

    JetThemeCore
    Version 1.2.1 | Von Crocoblock | Plugin-Seite aufrufen | View details

    JetTricks
    Version 1.3.2 | Von Crocoblock | Plugin-Seite aufrufen | View details

    Kava Extra
    Version 1.0.5 | Von Zemez | Plugin-Seite aufrufen

    Live Preview for Contact Form 7
    Version 1.2.0 | Von Addons for Contact Form 7 | Details ansehen

    Maintenance
    Version 3.97 | Von WebFactory Ltd | Details ansehen

    Send PDF for Contact Form 7
    Version 0.8.3 | Von Florent Maillefaud | Details ansehen

    I use the theme
    KavaVersion: 2.1.0
    Von Crocoblock

    Mikebridge theme.
    Child-Theme of Kava.

    Thread Starter neubi

    (@neubi)

    The Website is on Maintenance Mode at the moment – if you need to see it, let me know.

    Regards Rainer

    @neubi What version of WordPress are you using? I started getting this same 401 error on my forms submitted by anon users when I upgraded my staging site to the WordPress 5.6 RC2 release.

    I should mention that this occurs even when I’ve disabled all other plugins and themes.

    • This reply was modified 3 years, 11 months ago by chexwarrior.
    Thread Starter neubi

    (@neubi)

    Currently i use WordPress Version 5.5.3

    @neubi Ah, maybe your reason is different, does the error still occur when you submit the form in a private browsing session?

    Thread Starter neubi

    (@neubi)

    unfortunatley it does.

    Thread Starter neubi

    (@neubi)

    I think i did find the error. On all the affected websites i did find the following code on the functions.php of the Theme in use:

    add_filter( ‘rest_authentication_errors’, function( $result ) {
    if ( ! empty( $result ) ) {
    return $result;
    }
    if ( ! is_user_logged_in() ) {
    return new WP_Error( ‘401’, ‘not allowed.’, array(‘status’ => 401) );
    }
    return $result;
    });

    strangely enough all the funtions.php files in the affected site were changed on the same date – so I think an update of a plugin might habe been the reason.

    After commenting out that code all the forms are working porperly again.

    For me the failure was that I did this => Disable REST-API for all users except of admin

    So check if your rest-api is still ok for all users (can be deactivated by a security plugin or so , i did this myself , reverted it and all worked great again)

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Form submit only works when logged in to WP Backend’ is closed to new replies.