CronJob

By default, WordPress uses its built-in cron system, but it depends on user visits to trigger tasks. This can slow down your site and cause performance issues. A better approach is to use real server cronjobs to execute scheduled tasks efficiently.

Why You Should Use Real Server Cronjobs in WordPress

A cronjob is a scheduled task that runs at specific intervals. In Madara, cronjobs handle tasks like:

  • Deleting temporary folders used when uploading chapters.
  • Sending notifications to manga subscribers.
  • Running web crawlers to collect data.

WordPress has its own wp-cron, but it runs only when a visitor loads a page. This can:

  • Increase server load.
  • Delay execution of critical tasks.
  • Cause failures on low-traffic sites.

To avoid these issues, you should use real server cronjobs instead of WordPress’ default system.

How to Set Up Real Server Cronjobs for WordPress

Most hosting providers offer cronjob management tools like cPanel, Plesk, or WHM. Here’s how to set up a real server cronjob:

Step 1: Access Cronjob Settings on Your Server

  • Log in to your hosting control panel.
  • Search for “Cronjobs” or “Scheduled Tasks”.

Step 2: Add a New Cronjob

In the command field, enter:

bash
*/5 * * * * wget -q -O - 'https://yourwebsite.com/wp-cron.php?doing_wp_cron' >/dev/null 2>&1

πŸ‘‰ Replace https://yourwebsite.com with your actual domain.

Understanding the Cronjob Syntax

lua
* * * * *
| | | | |
| | | | ----- Day of week (0 - 7) (Sunday=0 or 7)
| | | ------- Month (1 - 12)
| | --------- Day of month (1 - 31)
| ----------- Hour (0 - 23)
------------- Minute (0 - 59)
  • */5 * * * * β†’ Runs every 5 minutes.
  • * */2 * * * β†’ Runs every 2 hours.

Set the interval to match the smallest frequency of your scheduled tasks.

Step 3: Disable WordPress Default Cronjob

To prevent conflicts, disable WordPress’ built-in cron system by adding this line to wp-config.php:

php
define('DISABLE_WP_CRON', true);

This ensures that WordPress no longer relies on user visits to execute tasks.

Benefits of Using Real Server Cronjobs

βœ… Reduces server load by eliminating unnecessary executions.
βœ… Ensures timely execution of scheduled tasks.
βœ… Improves site speed and performance.
βœ… Prevents delays in sending notifications or running crawlers.

By switching to real server cronjobs, you can enhance your WordPress site’s efficiency and avoid performance bottlenecks.

SHARE THIS POST

Leave a Reply

Your email address will not be published. Required fields are marked *

*

thirteen + 15 =