Embeddings Are Not Auto-Synced

If you notice that your embeddings are not updating automatically in the AI Engine plugin, it could be due to WordPress cron jobs not running as expected. This guide will help you understand the possible causes and how to resolve the issue.

Possible Causes

  • WordPress Cron Jobs Not Running: The AI Engine relies on scheduled events (cron jobs) to update embeddings every few minutes. If these cron jobs aren't running, embeddings won't auto-sync.
  • Server-Level Password Protection: If your website (including wp-cron.php) is behind a server-level password protection (like cPanel directory privacy), it can prevent cron jobs from executing.
  • Plugin Conflicts: Security, caching, or optimization plugins might interfere with scheduled events.
  • Misconfigured wp-config.php: Disabling WP-Cron in the configuration file stops all scheduled tasks.

How to Diagnose the Issue

1. Install WP Crontrol Plugin

  • Purpose: This plugin lets you view and manage all cron events in WordPress.

2. Check Cron Events

  • Navigate to: Tools > Cron Events in your WordPress dashboard.
  • Look for:
    • The mwai_5mn event (used by AI Engine for embeddings).
    • Any errors or warnings next to scheduled events (e.g., HTTP 401 errors).

3. Identify Errors

  • HTTP 401 Errors: Indicates unauthorized access, possibly due to password protection blocking wp-cron.php.
  • No Scheduled Events: Suggests that WP-Cron might be disabled or not functioning.

Solutions

1. Remove Server-Level Password Protection

If your site is password-protected at the server level (e.g., via cPanel):

  • Disable Directory Privacy:
    • Log in to your hosting control panel.
    • Navigate to Directory Privacy or similar.
    • Remove the password protection from your website directory.
  • Alternative: Use a WordPress plugin like Password Protected to restrict site access without blocking wp-cron.php.

2. Check for Plugin Conflicts

  • Disable Other Plugins:
    • Temporarily deactivate security, caching, or optimization plugins.
    • Check if embeddings start auto-syncing.
  • Reactivate Plugins One by One:
    • Identify if a specific plugin is causing the conflict.

3. Verify WP-Cron Is Enabled

  • Check wp-config.php:
    • Access your website files via FTP or a file manager.
    • Open the wp-config.php file.
    • Ensure there's no line that says define('DISABLE_WP_CRON', true);. If it exists, remove it or set it to false.

4. Use an External Cron Job

If you prefer or if WP-Cron isn't reliable:

  • Set Up a Server Cron Job:
    • Schedule a cron job on your server to call wp-cron.php at regular intervals.
    • This bypasses the need for visitors to trigger cron events.

Confirm the Fix

  1. Edit a Post: Make a change to any post to initiate the embedding process.
  1. Visit Your Website: Load any page to trigger WP-Cron (if using WP-Cron).
  1. Check Embeddings:
      • Go to AI Engine > Embeddings.
      • Verify that the embeddings have been updated.

Additional Tips

  • Regular Monitoring: Keep an eye on cron events using WP Crontrol to ensure they're running smoothly.
  • Hosting Support: If issues persist, contact your hosting provider to check for server-side restrictions.
  • Stay Updated: Ensure all plugins and WordPress are up-to-date to minimize compatibility issues.

Summary

Embeddings not auto-syncing is often due to issues with WordPress cron jobs. By ensuring wp-cron.php is accessible and cron jobs are running correctly, you can resolve the issue and keep your embeddings up-to-date automatically.

Did this answer your question?
😞
😐
🀩