Skip to main content
All CollectionsWordPress Tips & Tricks
How to Disable wp-cron.php in WordPress
How to Disable wp-cron.php in WordPress

Optimize WordPress performance by disabling wp-cron.php and setting up a server-side cron job with this step-by-step guide.

Christal Jackson avatar
Written by Christal Jackson
Updated over 3 months ago

The wp-cron.php file is responsible for handling scheduled tasks in WordPress, such as publishing scheduled posts, checking for updates, and more. However, on high-traffic sites, it can cause performance issues. Disabling it and setting up a real cron job is a more efficient approach.

Why Disable wp-cron.php?

By default, WordPress triggers the wp-cron.php file every time someone visits your site. This can lead to performance bottlenecks, especially on high-traffic sites. Disabling it and using a server-level cron job to handle tasks at regular intervals can improve performance.

Step-by-Step Guide to Disable wp-cron.php

Step 1: Edit the wp-config.php File

  1. Access your WordPress root directory using an FTP client or your hosting file manager.

  2. Locate the wp-config.php file and open it in a text editor.

  3. Add the following line of code above the line that says /* That's all, stop editing! Happy blogging. */:

    phpCopy code1define('DISABLE_WP_CRON', true);
  4. Save and close the wp-config.php file.

This code will disable the default WordPress cron job system.

Step 2: Set Up a Server-Side Cron Job

After disabling wp-cron.php, you need to set up a real cron job on your server to handle scheduled tasks.

  1. Access Your Hosting Control Panel:

    • Log in to your Apex Managed Hosting control panel.

  2. Navigate to the Cron Jobs Section:

    • Find the “Cron Jobs” or “Scheduled Tasks” section in your control panel.

  3. Create a New Cron Job:

    • Add a new cron job with the following command:

      bashCopy code1wget -q -O - https://yourdomain.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1
    • Set the cron job to run at regular intervals. A common setting is every 30 minutes, which you can specify using the following cron schedule syntax:

      Copy code1*/30 * * * *
    • Make sure to replace https://yourdomain.com with your actual site URL.

  4. Save the Cron Job:

    • Save the new cron job settings.

Benefits of Using a Server-Side Cron Job

  • Improved Performance: Reduces server load by not triggering wp-cron.php on every page load.

  • Reliable Scheduling: Ensures tasks are executed at precise intervals, regardless of site traffic.

Troubleshooting

  • Cron Job Not Running: Ensure the cron job command is correctly entered and your hosting provider supports cron jobs.

  • Scheduled Tasks Not Executing: Double-check the cron job settings and the URL used in the command.

By following these steps, you can efficiently manage WordPress scheduled tasks, enhancing your site's performance and reliability. If you encounter any issues or need further assistance, feel free to contact our support team.

Did this answer your question?