Hummingbird cache interferes with Quick Contact Form Ajax

I have done a chat with you guys several times over the past week. I am having a problem with Hummingbird (v1.9.3) cache blocking the Quick Contact Form process on my site. This form is accessed via the white envelope icon on the bottom of every page of the site. Sometimes the form will work, but sometimes the user will complete the form, get a correct captcha, but clicking Send will not result in an “Email Sent” confirmation message. I’m concerned we are missing messages because of this since there is no clear indication to the site visitor that the message failed. Checking google console when I encounter this problem myself will show "Failed to load resource: the server responded with a status of 403 (forbidden) - "[site]/wp-admin/admin-ajax.php"). A temporary solution to this problem has been clearing the Hummingbird page cache. In my last conversation with you guys (chat tech was Rupok Chowdhury), he suspected that a cache was trying to serve a cached version of the ajax data associated with the form. After disabling another cache I had enabled, I still encountered the problem. Rupok requested that I disable Hummingbird caching and monitor the site/form for a day or so and contact you again. Since I’ve disabled Hummingbird caching on 1/9, I have tested the form repeatedly and have not encountered any problems. So I’m inclined to agree with Rupok that the Hummingbird cache is interfering with the ajax process. Rupok suggested there might be a way to exclude the form request from caching so we can use Hummingbird caching without losing the form feature.

  • Nithin
    • Support Wizard

    Hi Sanctuary,

    Seems like the mentioned contact form is part of your theme. Basically to exclude a form, or a template from cache, adding the following rules in the code will make sure the cache is excluded:
    define('DONOTCACHEPAGE', true);

    Since it's a premium theme, I'm not fully aware of it's settings, and workflow. Could you please point out the settings where are the mentioned floating contact form added in the dashboard side, or whether it appears out of the box in the theme side?

    Do you know which exact template is used to load the contact form, so that we could give a closer look regarding that via the Default WordPress code editor too?

    Looking forward to your reply, so that we could help get this sorted.

    Regards,
    Nithin

  • Sanctuary
    • WPMU DEV Initiate

    Hi Nithin,

    Yes, the Quick Contact Form is apart of the Jupiter Wordpress Theme. The related php file for this form can be edited via Appearance>Editor>Jupiter Child Theme>Views>Footer>quick-contact.php

    Where would I put the define('DONOTCACHEPAGE', true); code?

    Is there a way to exclude the php file via the Hummingbird Exclusions settings instead?

  • Sanctuary
    • WPMU DEV Initiate

    When I didn't hear back from support, I went ahead and added define('DONOTCACHEPAGE', true); to the quick-contact.php file, hopefully in the right place. I've re-enabled Hummingbird cache and will monitor the form during the next couple of days.

  • Sanctuary
    • WPMU DEV Initiate

    Since I've re-enabled Hummingbird and added define('DONOTCACHEPAGE', true); to the quick-contact.php, Hummingbird has not cached a single page and the debug log shows repeatedly:
    PHP Notice: Constant DONOTCACHEPAGE already defined in [site path]/wp-content/themes/jupiter-child/views/footer/quick-contact.php on line 2. Can someone assist me?

  • Nithin
    • Support Wizard

    Hi Sanctuary,

    Sorry for the delay in getting back to you, please do note that we reply to tickets based on queue order, and hence the delay.

    I gave a look, and could notice the issue. Do you know in which file the quick-content.php is included in theme side? Seems like this could be more related to how the theme is calling the quick-content.php.

    Since it's a premium theme, we'll need to give a closer look regarding how the mentioned file is called, and it's workflow in the theme.

    The default WP Editor has limitations with searching the file templates, could you please share your sites WP admin, and FTP login in here, so that we could give a closer look within the theme side, and check what could be done to help get this fixed. I have commented out the define added in the quick-content.php file for the moment.

    You can send credentials by using our secure contact form: https://premium.wpmudev.org/contact/#i-have-a-different-question

    - To Mark to my attention, the subject line should contain only: ATTN: Nithin Ramdas
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    Please do follow up in the ticket once you have sent the above credentials. Have a nice day. :slight_smile:

    Kind Regards,
    Nithin

  • Sanctuary
    • WPMU DEV Initiate

    As of today, Hummingbird has cached 2/53 pages, so it appears to be working, but it seems odd that only 2 pages have been cached. How long does it take for Hummingbird to cache pages?

    The quick contact form is also still working since I've added the DONOTCACHEPAGE to the quick-content.php file. I don't understand your comment " I have commented out the define added in the quick-content.php file for the moment." because when I look at the quick-content.php file, define('DONOTCACHEPAGE', true); is still on line 2 NOT commented out.

  • Sanctuary
    • WPMU DEV Initiate

    Nevermind, I think page source for a cache page will say:
    <!-- This page is cached by the Hummingbird Performance plugin v1.9.3 - https://wordpress.org/plugins/hummingbird-performance/. -->

    I did a test of viewing (not logged into site) of our Board of Directors page (https://sanctuarycenters.org/about/board-of-directors/) and then checked the debug log, which said:
    Caching to file: [site path]/wp-content/wphb-cache/cache/sanctuarycenters.org/about/board-of-directors/c3a779fc24d7e3a793691b1c33592899.html
    [19:26:48] Cached file not found. Passing to ob_start.
    [19:26:48] Page not cached because DONOTCACHEPAGE is defined.

    So are these pages not getting cached because DONOTCACHEPAGE is present in the quick-content.php file?

  • Nithin
    • Support Wizard

    Hi Sanctuary,

    I have commented out the define added in the quick-content.php file for the moment." because when I look at the quick-content.php file, define('DONOTCACHEPAGE', true); is still on line 2 NOT commented out.

    I'm afraid, the mentioned link wasn't commented, as I had to enable it back to check with the developer. Sorry for not updating about that part. However, this is more of a theme specific issue, so we'll need to know how the theme works in order to suggest a workaround to make sure only the chat section doesn't get cached.

    Nevermind, I think page source for a cache page will say:
    <!-- This page is cached by the Hummingbird Performance plugin v1.9.3 - https://wordpress.org/plugins/hummingbird-performance/. -->

    Yes, that could be one instance you can check in the WordPress side, however depending upon some themes, the mentioned message can be hidden. So, in such cases, checking the Header Response for the following Response Headers, should confirm whether Hummingbird cache is working, or not:
    Hummingbird-Cache: Served

    When I currently check your homepage, I don't see the above mentioned headers, so can confirm Cache isn't working at the moment.

    If you could share the credentials, as mentioned in here:
    https://premium.wpmudev.org/forums/topic/hummingbird-cache-interferes-with-quick-contact-form-ajax#post-1370064

    We could give a closer look, and see what could be done to help get this fixed asap. Looking forward to your reply. Have a nice day ahead. :slight_smile:

    Regards,
    Nithin

  • Nithin
    • Support Wizard

    Hi Sanctuary,

    We usually keep the credentials separately and secured for each support ticket, so hence asked. However, I have accessed the credentials shared via another ticket you mentioned and tried to troubleshoot the issue further.

    Since the DONOTCACHEPAGE cache define is added in the quick-contact.php, and since the contact form appears in every page the cache isn't worked upon due to that.

    I checked for any workaround, but unfortunately, it doesn't help much. I'm bringing this into our Second Level Support(SLS) teams attention to see whether there are anything specific that could be done regarding this.

    Will keep you posted once I get further feedback regarding the status of the issue asap. Have a nice day ahead. :slight_smile:

    Regards,
    Nithin

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.