A community in which webmasters can ask for help with topics such as PHP coding , MySQL , IT jobs, web design, IT security.
Current location:homephp forumphp talk in 2008 yearRunning a scheduled task in a Wordpress plug-in - page 1
User InfoPosts
Running a scheduled task in a Wordpress plug-in#1
I(m trying to write a Wordpress plug-in that automatically posts a blog post at a certain time of day. For example, read a bunch of RSS feeds and post a daily digest of all new entries.

There are plug-ins that do something similar to what I want, but many of them rely on a cron job for the automated scheduling. I(ll do that if I have to, but I was hoping there was a better way. Getting a typical Wordpress user to add a cron job isn(t exactly friendly.

Is there a good way to schedule a task that runs from a Wordpress plug-in? It doesn(t have to run at exactly the right time.

posted date: 2008-09-10 05:32:00

Re: Running a scheduled task in a Wordpress plug-in#2
I had made out the solution of this problem. click to view my topic...

hope that hepls.

posted date: 2008-09-10 05:32:01

Re: Running a scheduled task in a Wordpress plug-in#3
vBulletin uses a sort of Pseudo-Cron system, that basically checks a schedule on every page access, and fires any processes that are due then.It(s been a while since I worked with Wordpress, but I think something like this should work if it runs on each page view.

posted date: 2008-09-10 05:45:00

Re: Running a scheduled task in a Wordpress plug-in#4
If you made it dependant on every attempted comment spam, you could have millisecond accuracy. :-)

posted date: 2008-09-10 05:47:00

Re: Running a scheduled task in a Wordpress plug-in#5
I think the best way to do this is with a pseudo-cron. I have seen it on several occasions, and although not exact in the timing, it should do what you need it to do. Since in Wordpress the index.php is the first thing always hit based upon the settings in the .htaccess, create a file called pseudo-cron.php, dump it into the root directory, and then require it once from the index. Whenever someone hits the site, it will run, and you can use it to initiate a script, and check if another daily digest needs to be generated depending upon the time of the day, and when the previous digest ran.

posted date: 2008-09-10 05:50:00

Re: Running a scheduled task in a Wordpress plug-in#6

posted date: 2008-09-10 06:08:00

Re: Running a scheduled task in a Wordpress plug-in#7
pseudo-cron is good but the two issues it has is1, It requires someone to "hit" the blog to execute. Low volume sites will potentially have wide ranging execution times so don(t be two specific about the time.2, The processing happens before the page loads. So if teh execution time happens and you have lots of "cron" entries you potentially upset visitors by giving them a sub standard experience.Just my 2 cents :-)

posted date: 2009-01-15 12:53:00

Re: Running a scheduled task in a Wordpress plug-in#8
I think you're wrong about #2. WordPress generates an asynchronous curl() call to itself to fire the job, so there's no noticeable delay for visitors. If you want to workaround #1, you can setup a cron job to `wget example.com/wp-cron.php'.

posted date: 2012-08-31 13:43:00

select page: « 1 »
Copyright ©2008-2017 www.momige.com, all rights reserved.