An expired listing is a listing that has not been sold by the end of the period stipulated in the listing contract between You and the listing users. If you are interested in implementing this solution on your website, follow the instructions below.


To implement the expired listing solution on Your website, we use WP-Cron. WP-Cron is how WordPress handles scheduling time-based tasks. It works by checking, on every page load, a list of scheduled tasks to see what needs to be run. Any tasks due to run will be called during that page load.


In the beginning, we need to disable WordPress's default wp-cron behavior by adding the following line to the wp-config.php file:

define('DISABLE_WP_CRON', true);

The next step is to setup a real cronjob. From your Linux terminal, first open crontab:

crontab -e

Then add a line like below in it.

*/10 * * * * curl http://yourwebsite.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

or

*/10 * * * * cd /var/www/yourwebsite.com/htdocs; php /var/www/yourwebsitename.com/htdocs/wp-cron.php?doing_wp_cron > /dev/null 2>&1

Please make sure you use correct path to wp-cron.php.


Alternately, you can also use WP-CLI

*/10 * * * * cd /var/www/yourwebsite..com/htdocs; wp cron event run --due-now > /dev/null 2>&1

CLI scripts do not have time limits. Depending on your setup, it may be desirable or undesirable. 


This code will run wp-cron every 10 minutes. If you want to change it just insert diferent number insteand 10. For exapmple */15 to make it run every 15 minutes.