• This post is out of hope and desperation in case anybody has encountered anything similar and has managed to fix it permanently, but I will be thankful for anything that might help me even hint at the cause. Apologies in advance if this turns out to be long.

    Basically, about 4 months ago, my site (a page is linked) started having frequent 404 errors on every page (or serving stale pages from the cache); following tips found in many places, I discovered that resaving permalinks cleared the problem; however, since then it has been happening every day, and I eventually figured out that it was happening twice a day, 12 hours apart, at (UTC time) 01:30 and 13:30. This regular pattern immediately made me suspect either a cron job or something occurring on the server. On checking the cron jobs (I already had WP Crontrol installed) there was no single cron that ran at both times, and about 3 that ran once at either of the times. I have been in contact with my (shared) host as well, who suggested it might be the ht-access file or a plugin that triggered a cron.

    I have worked through all the troubleshooting steps recommended and suggested to me so far (deactivating cache and security plugins, changing to a basic ht-access, stopping wp-cron and running it from a cPanel cron job instead, checking error log, running debugging, installed Query Monitor, checking browser console, deactivating plugins, changing theme etc etc), and I also added a function to my child theme to flush the permalinks on a regular basis as well as track the 404 errors, but obviously this just hid the problem rather than find the root cause, and a month ago I set up a clone of my site (staging site) on the same server to be able to troubleshoot the issue without disrupting the live site as much. However, the issue doesn’t occur on the staging site, despite everything being exactly the same. This effectively rules out it being a server issue, as well as custom code, theme or plugin problem, or even a WordPress issue, which has me completely stumped. The fact that it occurs at such regular moments and not any other time should be the clue to unlock the puzzle but I have run out of ideas, and am completely baffled as to why it doesn’t also occur on the staging site.

    So if anyone has any ideas, thoughts, suggestions or random bits of info that might help me resolve this, I’m all ears.

    For what it’s worth, I am running on WP 6.3, child theme of Blocksy, with Buddypress and a large number of plugins, all kept up to date, but given what I have written above, I’m not sure they are worth listing, but if someone would like to see I can post them as well.

    I should also mention that I am using PHP 8.1, and the server uses Apache 2.4.57 and MySQL 10.3.39-MariaDB (I know WP now gives a site health check warning about this being out of date, but the issue started before that).

    • This topic was modified 1 year, 6 months ago by AWOL.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Here are some additional steps and suggestions to help you further troubleshoot and potentially fix the problem:

    1. Check for Scheduled Tasks Outside WordPress: It’s possible that there might be some external server-level tasks or scripts that are causing this issue. Check with your hosting provider if there are any server-level tasks scheduled to run at the times when you’re experiencing 404 errors.
    2. Plugin Conflict Test: Even though you’ve deactivated some plugins, it’s still possible that there might be a conflict between plugins. Try disabling all plugins except for the essential ones (like Blocksy and BuddyPress) on your live site to see if the issue still occurs. If it doesn’t, re-enable plugins one by one to identify the one causing the problem.
    3. Theme Conflict Test: Similarly, try switching to a default WordPress theme (e.g., Twenty Twenty-One) to see if the issue persists. If it doesn’t, there might be an issue with your current theme (Blocksy). Ensure that your theme is also up to date.
    4. .htaccess File: You mentioned that you tried a basic .htaccess file, but if you haven’t already, you can try restoring the default WordPress .htaccess file. You can generate a fresh .htaccess file by going to Settings > Permalinks in your WordPress dashboard and clicking the “Save Changes” button.
    5. Check Your Server Logs: Check both your PHP error logs and Apache error logs for any entries around the times when the 404 errors occur. This might provide clues as to what’s causing the issue.
    6. Review Cron Jobs Again: Double-check your cron jobs, even the ones that run at different times. It’s possible that there’s a background process triggered by one cron job that is affecting the site at those specific times.
    7. Monitoring Tools: Continue to use monitoring tools like Query Monitor to watch for any unusual database queries or PHP errors around the times when the issue occurs.
    8. PHP and MySQL Versions: Since you mentioned using PHP 8.1 and MariaDB 10.3.39, ensure that all your plugins and themes are compatible with these versions. Outdated or incompatible plugins can sometimes cause unexpected issues.
    9. Cache Issues: Even if you’ve deactivated cache plugins, sometimes server-level caching can cause problems. Check with your hosting provider if they have server-level caching and if it’s possible to clear or disable it temporarily for testing.
    10. WordPress Core Files: Reinstall WordPress core files. Sometimes, core files can become corrupted, causing strange issues. Reinstalling WordPress core files can help rule out this possibility.
    11. Update WordPress: If you haven’t already, update your WordPress installation to the latest version. It’s essential to keep WordPress up to date for security and stability reasons.
    12. Security Audit: Consider performing a security audit on your website. Sometimes, security breaches or malware can manifest as strange issues. Ensure that your site is clean and secure.
    Thread Starter AWOL

    (@awol)

    Hi @shsajalchowdhury,

    Thank you for your very comprehensive list. Can I ask though, why do you think the same issue doesn’t afflict my cloned site? It was done with Duplicator, so I would think many things on your list can’t possibly be the cause (e.g. WP core files, cron jobs, theme conflict, plugin conflict, Scheduled Tasks Outside WordPress) and anything server related can’t be either as both live and staging site are on the same server (server level caching, PHP and MySQL Versions). But I will go through what you have suggested.

    You suggest a security audit – I don’t know how I would do one – can you suggest how or where I can find out? Also how can I check which plugins are compatible with my versions of PHP and MySQL? Very few plugins list this information.

    • This reply was modified 1 year, 6 months ago by AWOL.
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Twice a day pages give 404 error’ is closed to new replies.