Title: Run php code every 30 second
Last modified: August 31, 2016

---

# Run php code every 30 second

 *  [paolosimonetti](https://wordpress.org/support/users/paolosimonetti/)
 * (@paolosimonetti)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/run-php-code-every-30-second/)
 * Hi
 * I tried the plugin and it is very good!
 * I have a php that take some info and write them into a wordpress theme.
 * My need is: I just wanted to execute this php every 30 seconds.
 * Is there a chance to do that with this plugin?
 * THANKS
    PAOLO
 * [https://wordpress.org/plugins/add-actions-and-filters/](https://wordpress.org/plugins/add-actions-and-filters/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * (@msimpson)
 * [10 years, 1 month ago](https://wordpress.org/support/topic/run-php-code-every-30-second/#post-7238821)
 * Strictly speaking you can’t do this entirely inside WP. WP can only do an activity
   when someone accesses a page. It can’t spontaneously do an action at an interval,
   it can only react to a page access. That being said, WP has a [wp_cron()](https://codex.wordpress.org/Function_Reference/wp_cron)
   function and [wp_schedule_event()](https://codex.wordpress.org/Function_Reference/wp_schedule_event)
   where you can schedule a hook to run. But I don’t think it supports @30-sec intervals.
   Plus, if no one is hitting the site, it won’t run until someone does (later).
 * So you would have to set up something external to your site to trigger the action.
   If you have access to your Unix/Linux host, you could create a [cron](https://en.wikipedia.org/wiki/Cron)
   entry that would tell the server to do something every 30 seconds like run a 
   script or hit a URL on your site to trigger it do something. You could set up
   a special page on your site to trigger the action you want, then have Unix cron
   call curl or wget on that URL every 30 seconds.

Viewing 1 replies (of 1 total)

The topic ‘Run php code every 30 second’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/add-actions-and-filters_ffffff.svg)
 * [Add Shortcodes Actions And Filters](https://wordpress.org/plugins/add-actions-and-filters/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/add-actions-and-filters/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/add-actions-and-filters/)
 * [Active Topics](https://wordpress.org/support/plugin/add-actions-and-filters/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/add-actions-and-filters/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/add-actions-and-filters/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * 1 reply
 * 2 participants
 * Last reply from: [Michael Simpson](https://wordpress.org/support/users/msimpson/)
 * Last activity: [10 years, 1 month ago](https://wordpress.org/support/topic/run-php-code-every-30-second/#post-7238821)
 * Status: not resolved