• Resolved rafasantos

    (@rafasantos)


    Hi there! 👋
    I’m experiencing an issue with the plugin and getting the following error:
    Class “Techwebux\Hfc\Main” not found

    While investigating, I noticed something that might be related. According to the stack trace, the issue seems to involve this file:
    wp-content/plugins/head-footer-code/update.php:280
    It appears that the function auhfc_update_10 is being executed on every request (via the plugins_loaded hook), and it calls update_post_meta() for multiple posts. This results in database queries being triggered on every page load.

    From what I understand, this kind of update routine should typically run only once during a plugin update, not on every request. Could this behavior be related to the error I’m seeing?
    And is there a recommended fix or workaround for this?

    Thanks in advance for your help!
    Best regards,
    Rafa Santos

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Aleksandar UroÅ¡ević

    (@urkekg)

    Hi Rafa,

    Thank you for choosing Head & Footer Code for your plugin, and raising this ticket.

    The update routine should run only once. Please let me know do you use object cache (eg. Redis), and how many articles (pages, posts, etc) do you have on your website? It would help if you can share the stack trace).

    If you have staging website, I would appreciate it if you test development version from https://github.com/urosevic/head-footer-code

    Thank you,
    Aleksandar

    Thread Starter rafasantos

    (@rafasantos)

    Hi Aleksandar,

    Thank you for your response and support!

    To further investigate the issue, I set up a separate test server to isolate the environment and reproduce the problem safely.

    After installing and updating the plugin on this test environment, the issue persisted. The site started experiencing performance problems, and I was able to capture the following slow log / stack trace:

    [18-Mar-2026 12:46:15]  [pool cgsjesvxad] pid 149497
    script_filename = /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/index.php
    [0x00007f6a8a215de0] mysqli_query() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/class-wpdb.php:2357
    [0x00007f6a8a215d70] _do_query() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/class-wpdb.php:2271
    [0x00007f6a8a215c90] query() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/class-wpdb.php:3075
    [0x00007f6a8a215bc0] get_row() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/class-wp-post.php:243
    [0x00007f6a8a215b10] get_instance() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/post.php:1132
    [0x00007f6a8a215a60] get_post() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/revision.php:428
    [0x00007f6a8a2159a0] wp_get_post_revision() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/revision.php:312
    [0x00007f6a8a215920] wp_is_post_revision() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/post.php:2741
    [0x00007f6a8a215870] update_post_meta() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-content/plugins/head-footer-code/update.php:280
    [0x00007f6a8a215780] auhfc_update_10() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-content/plugins/head-footer-code/update.php:40
    [0x00007f6a8a2156f0] auhfc_update() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-content/plugins/head-footer-code/classes/techwebux/hfc/class-main.php:110
    [0x00007f6a8a215650] plugins_loaded() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/class-wp-hook.php:341
    [0x00007f6a8a215570] apply_filters() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/class-wp-hook.php:365
    [0x00007f6a8a215500] do_action() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-includes/plugin.php:522
    [0x00007f6a8a215420] do_action() /home/1602349.cloudwaysapps.com/cgsjesvxad/public_html/wp-settings.php:593

    Additional information:

    • We are not using Redis or any object cache
    • The site currently has around 33,000 posts
    • I also tested the plugin from the repository (master version), and it worked fine — no slow logs or errors were generated in that case

    One interesting finding during testing: After activating the repository (master) version of the plugin and then deactivating it, when I activated the original plugin again, the issue stops.

    It seems that the master version may have corrected something (possibly completing or fixing the update routine), which resolved the issue even when switching back to the original version.

    Please let me know if you need any additional information or if I can run further tests.

    Thank you again for your help!

    Best regards,
    Rafa Santos

    Thank you Rafa for additional details and testing master version on testing site.

    Please check if code snippets are okay on testing site and let me know if you spot some issue.

    In the github master version I added an update locker to prevent race condition for sites with a lot of articles. Technically, the issue is caused by starting the update 10 routine again before the previous process finishes and mark database version update as done.

    For next version 1.5.6 I have to implement batch update to routine 10 to make sure all post snippets are processed before PHP process timeouts on shared hosting packages with limited execution time, and memory. I’ll let you know once it’s ready.

    Cheers,
    Aleksandar

    Hi @rafasantos

    Plugin version 1.5.6 is available.

    I have successfully updated plugin from 1.4.6 to 1.5.6 on development website with 30k posts where each post have HFC code. Please let me know does it work for you too?

    Thread Starter rafasantos

    (@rafasantos)

    Hi!

    Everything worked perfectly. I first tested the update on a new staging site, and now I’m already running it in production without any issues.

    Thank you for the excellent support!

    Best regards,
    Rafa Santos

    Hey Rafa,

    Perfect! Thank you so much for your confirmation.

    Cheers,
    Aleksandar

Viewing 6 replies - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.