geek programmer geek programmer - 2 months ago 12
PHP Question

Replace the WordPress Cron with a Real Cronjob every 30 minutes

I want to replace the wordpress cron job with real cron job in PHP.
I tried to change wp-config.php with the following line but it's not working.

define('DISABLE_WP_CRON', false);


Another requirement is that i want to run this every 30 minutes. So for I have made one cron job in cron job tab of cpanel so i tried it with minutes (0,30) and hour etc. with start.

I have mentioned error_reporting() in the code but it's not showing any error.

Answer

irst, you need to disable the file to be hit every time someone loads your pages. To do this, open the wp-config.php file in your main WordPress folder and add this line at the end, before the closing ?> tag.

define('DISABLE_WP_CRON', true); 

And make your cron job setting like below picture. Change path of your cron job according to your cpanel directory.

enter image description here