[wp-hackers] wordpress auto update

Christopher Ross cross at thisismyurl.com
Sat Jul 2 09:44:53 UTC 2011


On Fri, Jul 1, 2011 at 5:23 PM, Otto <otto at ottodestruct.com> wrote:

> Kind of a long way around to do it, really. Better to use the
> get/set_site_transient functions instead of using the _site_transient_
> prefix yourself.
>
> Also, you can just hook to the set_site_transient_update_core and take
> your action then. That way, your code only runs when the core update
> check actually occurs. Something like this:
>
> add_action('set_site_transient_update_core', 'demo');
>
> function demo() {
>  $update_core = get_site_transient('update_core');
>   if (... stuff here to check $update_core->updates array ...) {
>     wp_mail(...);
>  }
> }
>
>

Thanks Otto, much cleaner! get_site_transient() makes a lot more sense to
use in this case.


More information about the wp-hackers mailing list