• If you are still using CentOS 7.9, it's time to convert to Alma 8 with the free centos2alma tool by Plesk or Plesk Migrator. Please let us know your experiences or concerns in this thread:
    CentOS2Alma discussion

problem with wp-cron.php on wordpress

fferraro87

Basic Pleskian
Hi,
i've find out today that scheduled posts in my wordpress site hosted in my plesk server, doesn't work as expected.
so i've investigated and check on my plesk configuration why it doesn't works.

First of all i've check date on my linux machine and it's correct.
After that i've check date.timezone on php.ini of domain and it's correct, so i've found a workaround using "scheduled tasks" on domain.
I've scheduled every minutes the execution of wp-cron.php and with this workaround, it works.

Do you have some idea why wp-cron.php isn't executed directly by wordpress?
it depends from wordpress installation or some configurations on Plesk?
(i've installed Plesk Onyx Version 17.5.3 Update #20 on Centos 6)

Thanks
 
i've found a solution.
Because my Plesk server is behind NAT, in order to make wordpress cron work again i've to edit file hosts on my plesk server and every domain inside my plesk server must be point to private IP.

There is a way to do this automatically everytime that i create a new domain? or there is a way to workaround this problem without edit file hosts?
 
I've scheduled every minutes the execution of wp-cron.php and with this workaround, it works.
Do you have some idea why wp-cron.php isn't executed directly by wordpress?

"wp-cron.php" and "Wordpress-Cron" are misleading. There is no real cron execution from Wordpress. What wordpress does is that the wp-cron.php execution is hooked to page requests. Everytime a page is requested, Wordpress checks whether a "Wordpress cron" execution is due and runs the script. When there are no page requests (no visitors for example), the script will not be executed. This is not an error.
 
"wp-cron.php" and "Wordpress-Cron" are misleading. There is no real cron execution from Wordpress. What wordpress does is that the wp-cron.php execution is hooked to page requests. Everytime a page is requested, Wordpress checks whether a "Wordpress cron" execution is due and runs the script. When there are no page requests (no visitors for example), the script will not be executed. This is not an error.
sorry you're right. but also if there are visitors on my page, it still doesn't works.
It works only if i add a line on file hosts with private IP for every domain inside my plesk
I hope that you have read this document - Running Plesk Behind a Router with NAT ?

Additionally, you can use Event Manager for running special scripts for specific customizations when selected event is triggered.
yes i've add my public ip inside "tools & settings"->"IP addresses" but i've still problem with wordpress cron.
 
Why would you keep wp-cron anyways? Disable wp-cron (e.g. via WP-CLI) and do Cron via your normal system CRON. Saves ressources, more effective, keeps your viewer from all the hassle of a background wp-cron slowing them down.
 
Peter, I understand your comment.. but how does that affect custom Wordpress Installs (Installs not using the Wordpress Toolkit). For example, we have a LOT of cusotmers who use a specific backup plugin called Updraft Plus. This plugin has settings that are supposed to allow the Wordpress Cron to start at a specified time (daily, weekly, etc..) and perform a backup of the files and database.
Every since moving to Plek Onyx, these plugins are no longer working. The sites still get visitors (both public and admin)... but the "automatic" cron process is never evoked. I shouldn't have to go in and set up an automated scheduled task for EVERY WordPress installation on my server.
Something about Plesk is preventing these tasks from running automatically and using the plugin settings as they were intended.
 
Back
Top