Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 950 Vote(s) - 3.56 Average
  • 1
  • 2
  • 3
  • 4
  • 5
When does wp-cron.php run in Wordpress?

#1
I need details about wp-cron. I used `wp_schedule_event`
for automatically sending emails.

But `wp_schedule_event` is only triggered when a user visits our site.
How to make the cron run automatically?
Reply

#2
You need to set the cron as wel after writing functionality in file..

Refer :

[To see links please register here]

Reply

#3
`wp_cron` does *not* run all the time in the background the way the name might suggest. That kind of scheduling isn't possible for a web application like WordPress, since the WordPress script only runs when someone is viewing the site and it does not run when no one is looking. What happens instead is that when the WordPress script boots, the cron values are checked and if one is (over)due it gets executed. It may be a few minutes late or a few hours late, but that is the way it works. `The wp_cron` jobs run at the first opportunity, basically.

If you want to run a script when someone visits the site, you don't really want `wp_cron` at all. `wp_cron` doesn't trigger when someone visits. It is a fuzzy timer. To run when someone visits you are going to have to think it through some. You could put a function in your theme's functions.php but it would run on every page load, not just on the first load of the visit. You could hook to `wp_login` and run your function when someone logs in. You are going to have to decide what counts as a 'visit' first.
Reply

#4
The real thing is always preferable, but it can be done in Wordpress (pure PHP):

[To see links please register here]

Reply

#5
It will run at first visit right after the scheduled time.
1.- yes, run automatically, but triggered by a visitor.
2.- it's enough to sending email in a scheduled basis.


----------

For a real cron behavior you can run a script using `crontab`

crontab -e
wget -q

[To see links please register here]


-q: quiet (no output). Just run the script. Otherwise you will have a lot of files in your server (wget pull files)


Tip:

[To see links please register here]



----------


Using cpanel:

[To see links please register here]


![enter image description here][1]


[1]:
Reply

#6
It seems that every one has just answered the way a *nix cron should be setup. Where as the real answer should be wordpress specific. There is a setting that can be done in the wp-config.php

define('DISABLE_WP_CRON', 'true');

Now if you can configure the *nix cron like Igor Parra answered, the background and offset cron jobs will not run any more, where as the time set in the control panel or crontab will be in effect.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through